note 80043 deleted from migration5.incompatible by danbrown
| From: | danbrown@php.net | Date: | Sun, 03 Aug 2008 02:33:46 +0000 |
| Subject: | note 80043 deleted from migration5.incompatible by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143076@lists.php.net to get a copy of this message | ||
Note Submitter: Emre Sururi
----
I had trouble with passing the variables from the command line. I used to do it simply by sending
them smt like:
php.exe filename.php firstvar=firstval secondvar=secondval
and reaping them through $_GET["firstvar"], $_GET["secondvar"] and this
elasticity allowed me to run the script without having anything to change either from the command
line as quoted above, or from the browser interface through:
localhost/filename.php?firstvar=firstval&secondvar=secondval
But PHP 5 just collects them in $_SERVER["argv"] array. And it differs whether you use the
command line or the browser interface. I solved this problem via the following procedure:
//For command line variable passing:
for($i=1;$i<sizeof($_SERVER["argv"]);$i++)
{
list($var0,$val0) = explode("=",$_SERVER["argv"][$i]);
$_GET[$var0] = $val0;
}