exec

string exec(string cmd, [variable array_name], [variable $return_value]) 
cmd Command to be executed
array_name Array to store the command output
return_value Variable to store the return status of the command

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.

Returns:

Last line of output from command cmd

Description:

exec() attempts to execute cmd in the system’s command interpreter. PHP waits until the command interpreter returns before execution of the script continues past the call to exec(). If you’re using a UNIX-like operating system, you can redirect stdout to a file or /dev/null to avoid this.

If the array_name ...

Get PHP Functions Essential Reference 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.