News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Exchange of Opinions

Started by Midgard, December 17, 2004, 05:45:43 AM

Previous topic - Next topic

Midgard

This topic is simple and advanced PHP codes including.
Please add your know codes.
-

1. The Execution Operator

The excecution operator is really a pair of backticks (``) in fact. The backtick is not a single quote--it is usually located on the same key as the ~ (tilde) symbol on your keyboard.

PHP will attempt to execute whatever is contained between the backticks as a command at the command line of the server. The value of the expression is the output of the command.

For example, under UNIX-like operating system, you can use

$out = `ls -la`;
echo  "<pre>".$out."</pre>";


or, equivalently on a Windows server

$out = `dir c:`;
echo  "<pre>".$out."</pre>";


Either of these versions will obtain a directory listing and store it in $out. It can then be echoed to the browser or dealt with in any order way.

Advertisement: