I just did that tonight.

Lookup the predefined variables in the manual.

$argc gives a count of the arguments
$argv is an array of the arguments

Ex:
php -q myscript.php Apple Orange

$argc == 3
$argv[0] == 'php -q myscript.php' or something like that
$argv[1] == 'Apple'
$argv[2] == 'Orange'

-Jason Garber
IonZoft.com

At 03:12 AM 11/1/2001 +0800, JIM wrote:
>hi all,
>i want to know how i can feed a parameter into a php script in commandline?
>eg.
>php getdata.php apple orange
>
>so, i want to get use of "apple" and "orange"...
>any help pls!
>
>jim
>
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to