Section 6.10. The Execution Operator


6.10. The Execution Operator

PHP uses backticks (') as its execution operator. Backticks are used very rarely in normal typing, so you might have trouble finding where yours isit is usually to the left of the 1 key on your keyboard.

Backticks allow you to pass commands directly to the operating system for execution, then capture the results. PHP replaces the result of the execution with what you asked to be executed. For example:

     print 'ls'; 

That will run the command ls and output its results to the screen. If you are using Windows, you will need to use dir instead, as ls is only available on Unix. You can perform any commands inside backticks that you would normally perform directly from the command line, including piping output to and from and/or redirecting output through other programs.

There are several functions that perform program execution like the execution operatoryou can find a more comprehensive reference to them in Chapter 7. Either way, you should be very wary about executing external programs from PHP because of potential security problems.



PHP in a Nutshell
Ubuntu Unleashed
ISBN: 596100671
EAN: 2147483647
Year: 2003
Pages: 249

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net