php - Get return value of a command -
i've found many ways run command, exec
,system
,shell_exec
, seem return command output.
i want return value (integer).
how can that?
<?php $retval = something("script.sh");
you can use exec()
exec("command", $output, $retval); echo "output: $output\n"; echo "return value: $retval\n";
exec()
consumes $output
, $retval
reference , values set inside of exec()
. check manual of exec()
again.
btw, $output
, $retval
implicitly initialized, don't need exist before exec()
call.
Comments
Post a Comment