I am having trouble understanding the exec
function in PHP. Can someone please explain it to me in simple terms?
views:
70answers:
4
+1
A:
exec — Executes command cmd in the system's command interpreter and returns the last line of output. Optional arguments allow the command output and return value to be captured.
string exec(cmd[, array_name][, $return_value]); string cmd: Command to be executed
kishore
2010-05-11 11:36:43
A:
(There seems little point in providing any other answer without a more specific question)
David Dorward
2010-05-11 11:37:04
A:
exec
will call a program on the pc which runs your script and will return the last line of the output. e.g.
$result = exec('echo bla');
echo $result; // outputs 'bla'
(usually you don't want to use it, and some shared hosting servers do not allow it's usage due to security concerns)
knittl
2010-05-11 11:48:19
A:
i prefer shell_exec http://php.net/manual/en/function.shell-exec.php it returns all output
Osman Üngür
2010-05-11 12:12:36