note 40997 added to ref.exec

From: Date: Thu, 25 Mar 2004 23:35:42 +0000
Subject: note 40997 added to ref.exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-67181@lists.php.net to get a copy of this message
Quick chart that helped me immensely (Best (+) / worst (o) of each command) and when to use each (w). | exec(string cmd, [array cmd_output, [int cmd_exit_status]]) +- Second (optional) argument holds an array containing the output line by line. +- Third (optional) argument holds the exit status of the executed program. w- When the output of a command is only important to the program. | system(string cmd, [int cmd_exit_status]) +- Echos ascii output straight to browser (only stdout; stderr must be redirected by putting 2>&1 after the command to see errors). +- Second (optional) argument holds the exit status of the executed program. w- When the output of a command is important to the user. The more I go over my notes the less I care for the last two functions. Shell_exec() = exec() + implode() - exit codes. And while neccessary to be able to pipe binary through php, most people will never use passthru | passthru(string cmd, [int cmd_exit_status]) +- Echos binary output directly to browser window. +- Second (optional) argument holds the exit status of the executed program. w- When the output of a command is binary. | shell_exec(string cmd) <-- minimal features to maintain sync with normal use of backticks. +- Returns full output as a string instead of directly to the browser (only stdout; stderr must be redirected). o- No way to check exit status (Should use system() with both stderr and stdout redirected to /dev/null to get the exit code). ---- Manual Page -- http://www.php.net/manual/en/ref.exec.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40997 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40997&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40997&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#67181) next »