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: 2026-03-10
303



Was this answer useful?
Choose a quick rating so we can improve the next answer for you.
How satisfied are you?


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

Lectures and tutorial on "Running server side scripts using PHP as an example (LAMP)"

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