note 41229 deleted from function.getopt by nlopess
| From: | nlopess@php.net | Date: | Fri, 09 Apr 2004 14:26:17 +0000 |
| Subject: | note 41229 deleted from function.getopt by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-67889@lists.php.net to get a copy of this message | ||
Note Submitter: aslandas@ankara.edu.tr
----
if your php version is belower than 4.3.0 you can use this function,
function getOptions($opt)
{
$paramNum = $GLOBALS["argc"];
$paramStr = $GLOBALS["argv"];
for($i=1; $i<$paramNum; $i++) {
if (($paramStr[$i][0] == "-") && ($subOpt = strstr($opt,
$paramStr[$i][1]))) {
if (($subOpt[1] == ":") && ($paramStr[$i+1][0] != "-")) {
$param[$paramStr[$i][1]] = $paramStr[$i+1];
$i++;
} else {
$param[$paramStr[$i][1]] = "";
}
}
}
return $param;
}