note 36231 added to features.commandline
| From: | Spider dot 007 at rn2 dot php dot net | Date: | Wed, 01 Oct 2003 21:36:08 +0000 |
| Subject: | note 36231 added to features.commandline | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-57560@lists.php.net to get a copy of this message | ||
My version of PHP didn't support the $argv and $argc variables anymore; so I wrote this:
<?PHP
function cmd_args(){
// Returns an array containing the command line arguments
$args = (array_keys($_GET));
str_replace(getcwd(), '', $args);
$args = $args[0];
$args = explode('_', $args);
unset($args[0], $args[1], $args[2]);
ksort($args);
return $args;
}
?>
It generates an array with the arguments given on the command line and will return an array like
this:
<?
Array
(
[3] => this
[4] => is
[5] => a
[6] => test
)
?>
----
Manual Page -- http://www.php.net/manual/en/features.commandline.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+36231
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+36231&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+36231&report=yes