$argv
$argv
Array of arguments passed to script
Contains an of all the arguments passed to the script when running
from the .
arraycommand line
Opmerking: > The first argument is always the name that was used to run the script.
$argv[0]
Opmerking: > This variable is not available when is disabled. register_argc_argv
Waarschuwing: > To test if a script is being run from the command line, should be used instead of checking whether or is set.
php_sapi_name``$argv``$_SERVER['argv']
Voorbeeld: example
<?php
var_dump($argv);
?>
When executing the example with: php script.php arg1 arg2 arg3
array(4) {
[0]=>
string(10) "script.php"
[1]=>
string(4) "arg1"
[2]=>
string(4) "arg2"
[3]=>
string(4) "arg3"
}
Opmerking: > This is also available as .
$_SERVER['argv']
getopt$argc