Page 1 of 1

Passing arguments on the commandline

Posted: Wed Jul 10, 2002 5:05 am
by Paul Oertel
I want to pass some arguments to a PHP script from the commandline.

The code looks like this:

Code: Select all

<$php

$param = $argv&#1111;1];
echo $param;

?>
When I run it I get the following result:

Code: Select all

E:\PHP>php -f "m:\reportnt.php" Thisisaparameter

PHP Notice:  Undefined variable:  argv in m:\reportnt.php on line 24

E:\PHP>
Am I doing something wrong here?

Paul

Posted: Wed Jul 10, 2002 5:25 am
by BDKR
Try using $_SERVER[argv] and if you need, $_SERVER[argc].

Later on,
BDKR (TRC)