note 1931 deleted from language.variables.external by didou

From: Date: Wed, 21 Jan 2004 09:27:50 +0000
Subject: note 1931 deleted from language.variables.external by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-63924@lists.php.net to get a copy of this message
Note Submitter: patrick.vuarnoz@tamedia.ch ---- Concerning parameters on the command-line: If you are trying to run a php-script as a shell command, you can add this function to your code to get access to the parameters on the command-line: function get_commandline() { global $HTTP_SERVER_VARS; for ($i=0; $i<$HTTP_SERVER_VARS['argc']; $i++) { $my_args = array(); if (ereg("(.*)=(.*)", $HTTP_SERVER_VARS['argv'][$i], $my_args)) { $GLOBALS[$my_args[1]] = $my_args[2]; } } } This parses the all the given parameters in a call like "test.php arg1=abc arg2=def" into variables in the global scope, named as the arguments were ($arg1 is set now to "abc").

« previous php.notes (#63924) next »