Skip to content

Instantly share code, notes, and snippets.

@pwlin
Created December 1, 2009 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwlin/246480 to your computer and use it in GitHub Desktop.
Save pwlin/246480 to your computer and use it in GitHub Desktop.
Convert PHP $argv to $_GET
<?php
if ($argv) {
foreach ($argv as $k=>$v){
if ($k==0) continue;
$it = explode("=", $v);
if (isset($it[1])) {
$_GET[$it[0]] = $it[1];
}
}
}
// print_r($argv);
// print_r($_GET);
// php -f info.php test=1
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment