note 124279 deleted from book.exec by salathe
| From: | salathe@php.net | Date: | Wed, 09 Oct 2019 14:27:21 +0000 |
| Subject: | note 124279 deleted from book.exec by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212564@lists.php.net to get a copy of this message | ||
Note Submitter: bishop at php dot net
----
There is also the backtick ("back-tick") execution operator:
https://www.php.net/manual/en/language.operators.execution.php
<?php
$output =
ls -al;
echo "<pre>$output</pre>";
?>
This operator runs the command given inside the backticks, and supports string interpolation just
like double quotes:
<?php
$host = 'example.com';
echo ping -n 3 {$host};
?>
Backticks have no special meaning inside of double quotes:
<?php
echo "I said ls to you!"; # outputs: I said ls to you!
?>
Since this operator runs a command on your system, and accepts variables, you must be very careful
to sanitize input and understand what's being run -- don't use it lightly. The same can be
said of the execution functions in this chapter.