- Instant help with your Php coding problems

Check command line arguments in PHP

Question:
How to check command line arguments in PHP?
Answer:
foreach ($argv as $arg) {
    echo $arg . "\r\n";
}
Description:

To get the command line arguments in your PHP script use the $argv array in your script. This array contains all the arguments passed to the script when running from the command line.

The first argument $argv[0] is always the name that was used to run the script.

Note: This variable is not available when register_argc_argv is disabled.

Reference:
The $ergv reference
Share "How to check command line arguments in PHP?"
Tags:
get, check, command line, argument, parameter, php, script
Technical term:
Check command line arguments in PHP