From bbf6fbd07006e635d70ded1b5eeb12d2d8313442 Mon Sep 17 00:00:00 2001 From: "Daniel P. Brown" Date: Mon, 29 Nov 2010 17:04:30 +0000 Subject: [PATCH] Rewrite of $argv blurb, which not only contained a typo, but was rather confusing in its present form. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@305839 c90b9560-bf6c-de11-be94-00142212c4b1 --- features/commandline.xml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/features/commandline.xml b/features/commandline.xml index 575ec5de23..9d08c6c61f 100644 --- a/features/commandline.xml +++ b/features/commandline.xml @@ -1075,9 +1075,14 @@ $ some_application | some_filter | php | sort -u > final_output.txt can be passed to your script is not limited by PHP (the shell has a certain size limit in the number of characters which can be passed; usually you won't hit this limit). The arguments passed to your script are available in the - global array $argv. The zero index always contains the - script name (which is - in case the PHP codeis coming from - either standard input or from the command line switch ). + global array $argv. The first index (zero) always contains the + name of the script as called from the command line. Note that, if the code is + executed in-line using the command line switch , the value of + $argv[0] will be simply a dash (-). The + same is true if the code is executed via a pipe from STDIN. + + + The second registered global variable is $argc which contains the number of elements in the $argv array (not the number of arguments passed to the