|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-04-03 14:02 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Apr 07 06:00:02 2026 UTC |
Description: ------------ You can only call getopt a single time and get results. Getopt should reset what ever pointers it uses to ensure state is as it was prior to calling getopt. An example.. A modular based system using a config file or command line to load a module, It is impossible for the module to use getopt to look for module specific settings because getopt has already been called by the main engine. ./engine -loadmod abc -abcdb 123 It is impossible for mod abc to realize it needs to load database 123 because any attempts to run getopt based on those new params fail. Reproduce code: --------------- <? $cl_input = getopt('c:h'); print_r($cl_input); $cl_input = getopt('c:h'); print_r($cl_input); ?> Expected result: ---------------- [root@fs streams]# php test.php -c 1 Array ( [c] => 1 ) Array ( [c] => 1 ) Actual result: -------------- [root@fs streams]# php test.php -c 1 Array ( [c] => 1 ) Array ( )