Re: [DOC-CVS] svn: /phpdoc/ en/trunk/language/predefined/variables/argv.xml sr/trunk/language/predefined/variables/argc.xml sr/trunk/language/predefined/variables/argv.xml

[email protected] (Richard Quadling) Wed, 4 May 2011 10:46:44 +0100
Newsgroups php.doc.cvs,php.doc.sr
Message-ID <[email protected]>
2011/5/4 Nikola Smolenski <[email protected]>:
> nikola                                   Wed, 04 May 2011 03:24:06 +0000
>
> Revision: http://svn.php.net/viewvc?view=revision&revision=310748
>
> Log:
> - The first argv argument is not just the script filename
>
> - New sr translation
>
> Changed paths:
>    U   phpdoc/en/trunk/language/predefined/variables/argv.xml
>    U   phpdoc/sr/trunk/language/predefined/variables/argc.xml
>    A   phpdoc/sr/trunk/language/predefined/variables/argv.xml
>
> Modified: phpdoc/en/trunk/language/predefined/variables/argv.xml
> ===================================================================
> --- phpdoc/en/trunk/language/predefined/variables/argv.xml      2011-05-04 01:58:27 UTC (rev 310747)
> +++ phpdoc/en/trunk/language/predefined/variables/argv.xml      2011-05-04 03:24:06 UTC (rev 310748)
> @@ -15,8 +15,8 @@
>   </para>
>   <note>
>    <simpara>
> -    The first argument is always the current script's filename, therefore
> -    <varname>$argv[0]</varname> is the script's name.
> +    The first argument <varname>$argv[0]</varname> is always the name that was
> +    used to run the script.
>    </simpara>
>   </note>
>   <note>

That is a really good point. Especially if you are on Windows and have
setup PHP to work along the lines as indicated in
http://docs.php.net/manual/en/install.windows.commandline.php

It is entirely possible to get PHP to run in the form of ...

script1 --arg1 --arg2 | script2 --arg1 --arg2

That is 2 PHP scripts, the second one running as a filter on the
output of first.

No mention of php.exe and no .php extension.

In these instances, $argv[0] is going to be 'script1' and 'script2'.

This is the same issue for any "program"  in Windows where the
"program" is accessible via PATH, the extension is in PATHEXT and the
handler for that type is logged and PATH'd.

Richard.




-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY