Skip to content

Instantly share code, notes, and snippets.

@werty1st
Created July 9, 2013 09:35
Show Gist options
  • Save werty1st/5956040 to your computer and use it in GitHub Desktop.
Save werty1st/5956040 to your computer and use it in GitHub Desktop.
php commandline args parser
$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