Name

exec

Synopsis

$last_line = exec($command);

$last_line = exec($command, $output_array);

$last_line = exec($command, $output_array, $return_code);

Executes command as a Unix command in a subshell. Only the last line of the command output is returned. If an array is provided as the second argument, all of the lines of output from the command are placed in the array. If a third argument is present, the return code from the command is placed in that variable.

Get MySQL and mSQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.