These lines will convert the arguments of a CLI call like php myfile.php "type=daily&foo=bar"
into the well known $_GET
-array:
if (!empty($argv[1])) {
parse_str($argv[1], $_GET);
}
Though it is rather messy to overwrite the global $_GET
-array, it converts all your scripts quickly to accept CLI arguments.
See parse_str for details.