Introduction
When a PHP script is run from command line, $argv superglobal array contains arguments passed to it. First element in array $argv[0] is always the name of script. This variable is not available if register_argc_argv directive in php.ini is disabled.
$argv
Following script is executed from command line.
Example
<?php var_dump($argv); ?>
Output
array(1) { [0]=> string(8) "main.php" }
In another example as follows, addition of command line arguments is performed
Example
<?php $add=$argv[1]+$argv[2]; echo "addition = " . $add; ?>
Output
C:\xampp\php>php test1.php 10 20 addition = 30