exec¶
exec() use used to execute a command with the underlying operating system. It is the equivalent of shell_exec() and back-ticks.
exec() has specific arguments to collect both the result of the command, one line per element in an array, and the resulting code. This differs from shell_exec(), which only returns the result, and as a string.
<?php
$dir = exec('ls', $result);
print_r($result);
?>
See also PHP shell_exec() vs exec() Function.
Related : shell_exec(), Back-tick, Back-tick, Execution, Shell Exec, System Call