You get a bonus - 1 coin for daily activity. Now you have 1 coin

Operators for executing external commands in PHP

Lecture



PHP supports one statement of execution: backquotes (``). Note that these are not single quotes. PHP tries to execute a string enclosed in back quotes as a console command, and returns the output (i.e., it is not just issued at the output, but, for example, can be assigned to a variable). Using backquotes is similar to using shell_exec () .

<?php
$output = `ls -al`;
echo "<pre>$output</pre>";
?>

Note: back quotes are not available if the safe mode is set or the shell_exec () function is disabled .

See also: functions for executing programs, popen () proc_open () .

created: 2016-01-25
updated: 2021-03-13
132424



Rating 9 of 10. count vote: 2
Are you satisfied?:



Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Running server side scripts using PHP as an example (LAMP)

Terms: Running server side scripts using PHP as an example (LAMP)