Created
November 14, 2012 19:55
-
-
Save auroraeosrose/4074364 to your computer and use it in GitHub Desktop.
http_parse_query is parse_str with non-stupid api (and fits http_build_query better as well)
This file contains 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
/* {{{ proto array http_parse_query(string encoded_string) | |
parses query string into array */ | |
PHP_FUNCTION(http_parse_query) | |
{ | |
char *arg; | |
int arglen; | |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arglen) == FAILURE) { | |
return; | |
} | |
array_init(return_value); | |
res = estrndup(arg, arglen); | |
sapi_module.treat_data(PARSE_STRING, res, return_value TSRMLS_CC); | |
} | |
/* }}} */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note original parse_str is here http://lxr.php.net/xref/PHP_5_4/ext/standard/string.c#4209 - almost identical but for API and removal of "import into global scope" crazies