note 101143 added to features.commandline.usage
| From: | lawrence at krubner dot com | Date: | Mon, 29 Nov 2010 17:04:48 +0000 |
| Subject: | note 101143 added to features.commandline.usage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174443@lists.php.net to get a copy of this message | ||
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
----
Server IP: 69.147.83.197
Probable Submitter: 209.131.116.82
----
Manual Page -- http://www.php.net/manual/en/features.commandline.usage.php
Edit -- https://master.php.net/note/edit/101143
Del: integrated -- https://master.php.net/note/delete/101143/integrated
Del: useless -- https://master.php.net/note/delete/101143/useless
Del: bad code -- https://master.php.net/note/delete/101143/bad+code
Del: spam -- https://master.php.net/note/delete/101143/spam
Del: non-english -- https://master.php.net/note/delete/101143/non-english
Del: in docs -- https://master.php.net/note/delete/101143/in+docs
Del: other reasons-- https://master.php.net/note/delete/101143
Reject -- https://master.php.net/note/reject/101143
Search -- https://master.php.net/manage/user-notes.php