Executing External Programs
We can execute external programs using PHP
That may be usefull for some situation
the backtick operator (`),
which can be used to run an external program from within a PHP script.
PHP uses exactly the same technique: simply enclose the command line to your external program within backticks inside a PHP script, and PHP will launch the external program when it reaches that line of code.
following code hows you how a backtics can be used
< ?php
`ls -l`;
? >
Of course, this is fairly useless by itself; in most cases, you will want to import the output of the external program into your PHP script for further processing. Fortunately, that’s simple — all you do is treat the backtick-enclosed code as a regular PHP variable and display it using echo() or print().
We can also user
exec() and passthru()
which execute the external program and gives us raw output.
