note 45123 added to features.commandline
| From: | phpatdeathz0rzdothomeunixdotnet at osu1 dot php dot net | Date: | Thu, 26 Aug 2004 18:31:26 +0000 |
| Subject: | note 45123 added to features.commandline | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-75349@lists.php.net to get a copy of this message | ||
To parse the command line arguments, use the following script:
<?php
$args=array();
for($i=1;$i<$argc;++$i)
$args[$argv[$i]]=$argv[++$i];
?>
./arguments.php -v 1 -username deathz0rz
will produce:
Array
(
[-v] => 1
[-username] => deathz0rz
)
note that this script is intended for use with options that take an argument (like -port 8080). -v
-port 8080 -q -r wont work.
----
Manual Page -- http://www.php.net/manual/en/features.commandline.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45123
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45123&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45123&report=yes
Search -- http://master.php.net/manage/user-notes.php