Home >Backend Development >PHP Tutorial >$argv and $argc_PHP tutorial in php

$argv and $argc_PHP tutorial in php

WBOY
WBOYOriginal
2016-07-13 17:47:593071browse

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" } 

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478462.htmlTechArticleCommand line variables can be used in php. Too many words and too abstract, use script to speak: ?php echo $argv[1]./n; echo $argv[2]./n; echo $argc./n; print_r($argv); var_dump($argv ); ? Run script...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn