note 101143 rejected from features.commandline.usage by thiago
| From: | thiago@php.net | Date: | Mon, 29 Nov 2010 17:06:09 +0000 |
| Subject: | note 101143 rejected from features.commandline.usage by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174444@lists.php.net to get a copy of this message | ||
Note Submitter: lawrence at krubner dot com
----
I'm fairly sure someone made a mistake when editing this sentence:
"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 -r )"
The part in parenthesis makes no sense, and "codeis" is an obvious typo.
Empty quote marks would be helpful. I believe the above sentence is trying to indicate that the
script name is empty when the PHP code is coming from standard input, or when you try to execute PHP
code from the command line using the -r flag.
For instance, this code works fine, when executed on the command line:
php -r "echo 'hi';"
but this:
php -r "print_r($argv);"
gets me this:
Warning: print_r() expects at least 1 parameter, 0 given in Command line code on line 1
and this gets the same error:
php -r "echo 'hi'; print_r($argv);"
hi
Warning: print_r() expects at least 1 parameter, 0 given in Command line code on line 1