Re: PHP shell scripting..
| From: | () | Date: | Sun, 22 Jul 2001 19:14:41 +0000 |
| Subject: | Re: PHP shell scripting.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-59086@lists.php.net to get a copy of this message | ||
In article <001c01c112da$b8c0d420$0d6fa8c0@local>, Ryan Christensen wrote:
>I have some questions about using PHP as a shell scripting language...
>mainly how you pass arguments to a script on the command line. Say I'm
>using:
>
>--------------------------
>#!/usr/local/bin/php -q
>
><?
>print "I am: $name\n";
>?>
>--------------------------
>
>How do I define test from the command line (as an argument while
>executing the script)?
The script arguments are in an array ($argv). Get them by using something
like:
<?php
print "I am " . $argv[1];
?>
Regards,
Hans
--
http://phpreview.nl.linux.org