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

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -