Tag: pass value to command line argument in PHP

Pass command line argument to PHP

The command line arguments are stored in an array in the $_SERVER variables called ‘argv’. Running the command “php index.php test1 test2” and then doing print_r($_SERVER[‘argv’]) would output this: [php] Array ( [0] => index.php [1] => test1 [2] => test2 ) [/php] You can also use $argv, It has return the same value. $argc …

Continue reading

Permanent link to this article: https://blog.openshell.in/2012/07/pass-command-line-argument-to-php/