note 82793 added to function.getopt
| From: | uberlinuxguyattulgdotorg at osu1 dot php dot net | Date: | Fri, 25 Apr 2008 20:26:03 +0000 |
| Subject: | note 82793 added to function.getopt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138782@lists.php.net to get a copy of this message | ||
One thing of important note would be that getopt() actually respects the '--' option to
end an option list. Thus given the code:
test.php:
<?
$options = getopt("m:g:h:");
if (!is_array($options) ) {
print "There was a problem reading in the options.\n\n";
exit(1);
}
$errors = array();
print_r($options);
?>
And running:
# ./test.php ./run_vfs -h test1 -g test2 -m test3 -- this is a test -m green
Will return:
Array
(
[h] => test1
[g] => test2
[m] => test3
)
Whereas running:
# /test.php ./run_vfs -h test1 -g test2 -m test3 this is a test -m green
Will return:
Array
(
[h] => test1
[g] => test2
[m] => Array
(
[0] => test3
[1] => green
)
)
----
Server IP: 208.69.120.35
Probable Submitter: 128.220.13.17
----
Manual Page -- http://www.php.net/manual/en/function.getopt.php
Edit -- https://master.php.net/note/edit/82793
Del: integrated -- https://master.php.net/note/delete/82793/integrated
Del: useless -- https://master.php.net/note/delete/82793/useless
Del: bad code -- https://master.php.net/note/delete/82793/bad+code
Del: spam -- https://master.php.net/note/delete/82793/spam
Del: non-english -- https://master.php.net/note/delete/82793/non-english
Del: in docs -- https://master.php.net/note/delete/82793/in+docs
Del: other reasons-- https://master.php.net/note/delete/82793
Reject -- https://master.php.net/note/reject/82793
Search -- https://master.php.net/manage/user-notes.php