Re: Passing variables to the script

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: Passing variables to the script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-96552@lists.php.net to get a copy of this message
[plz excuse the rephrasing] > Is it possible to pass variables to php script from the command line? Yes. > in form of var1=val1&var2=val2 No. You have to pass them in as arguments... For Example: [SCRIPT] #!/usr/local/bin/php -q <?php print_r($argv); ?> [EXECUTION] [10:11:28][dhardiker@amnesiac]:~$ chmod +x test.php [10:11:31][dhardiker@amnesiac]:~$ ./test.php arg1 arg2 arg3 Array ( [0] => ./test.php [1] => arg1 [2] => arg2 [3] => arg3 ) [10:11:43][dhardiker@amnesiac]:~$ rm test.php -- Dan Hardiker [dhardiker@staff.firstcreative.net] ADAM Software & Systems Engineer First Creative Ltd

« previous php.general (#96552) next »