The execution operator
The least complicated of all three special operators is the execution operator, which is ` - a back tick. Back ticks are used very rarely in normal typing, so you might have trouble finding where yours is - it is almost certainly to the left of your 1 key on your keyboard. It may well share a key with other obscure symbols such as ¬.
The execution operator in PHP is very clever - it allows you to pass commands direct to the operating system for execution, then capture the results. PHP literally replaces the result of the execution with what you asked to be executed. For example:
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 back ticks that you would normally perform direct 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 operator - you can find a more comprehensive reference to them in the Functions chapter.
Next chapter: Operator precedence and associativity >>
Previous chapter: The scope resolution operator
Home: Table of Contents