Home >Backend Development >PHP Tutorial >$argv and $argc_PHP tutorial in php
Command line variables are available in php. Too many words and too abstract, use script to speak:
When running the script, the command line is: php argvtest.php TQ TQx
The output result is:
TQ TQx $argv is an array 3. Note the $argc variable, which is used to save the number of elements in the $argv array. There is one more than the normal input. After printing it, you will know that there is one more script file name Array ( [0] => argvtest.php [1] => TQ [2] => TQx ) array(3) { [0]=> string(12) "argvtest.php" [1]=> string(2) "TQ" [2]=> string(3) "TQx" }