Note that these (``) are not single-quotes! Execution Operator is identical to shell_exec() function. The backtick operator is disabled when safe mode is enabled or shell_exec() is disabled. Backticks cannot be used within double-quoted strings. We can even run Windows dos commands. |
<?php $executionOpOutput = `ls -ltr`; echo "<pre>$executionOpOutput</pre>"; } ?>
Example 2: Running DOS commandsOutput
<?php $executionOpOutput = `ver`; echo "<pre>$executionOpOutput</pre>"; } ?>
Example 3: Running DOS dir commandsOutput
Microsoft Windows [Version 6.3.9600]
<?php $executionOpOutput = `ver`; echo "<pre>$executionOpOutput</pre>"; } ?>
Output
Volume in drive I is Code2care Volume Serial Number is 70BE-20EE Directory of I:\xampp\htdocs\xampp\Tutorials 12/26/2013 08:38 PM