/ Published in: PHP

seen in comments in http://es2.php.net/features.commandline
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function getArgs($args) { $last_arg = null; $out[$key] = $parts[1]; } else { $out[$key] = true; } $last_arg = $key; } $key = $match[1]{$j}; $out[$key] = true; } $last_arg = $key; } else if($last_arg !== null) { $out[$last_arg] = $args[$i]; } } return $out; } /* sample php file.php --foo=bar -abc -AB 'hello world' --baz produces: Array ( [foo] => bar [a] => true [b] => true [c] => true [A] => true [B] => hello world [baz] => true ) */ ?>
URL: http://es2.php.net/features.commandline
Comments
