Created
July 9, 2013 09:35
-
-
Save werty1st/5956040 to your computer and use it in GitHub Desktop.
php commandline args parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$options = getopt("d::t::"); | |
$d = array_key_exists("d",$options); | |
$t = array_key_exists("t",$options); | |
switch (strlen($options["d"])){ | |
case 3: $dddd = true; | |
case 2: $ddd = true; | |
case 1: $dd = true; | |
} | |
if($t) echo "t is set\n"; | |
if($d) echo "d is set\n"; | |
if($dd) echo "dd is set\n"; | |
if($ddd) echo "ddd is set\n"; | |
if($dddd) echo "dddd is set\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment