Administrators Leon Posted August 16, 2012 Administrators Share Posted August 16, 2012 I'll like to thank Jan Suomi for finding this one: Its a neat little php script for parsing a URL and splitting into a array: <?php function parse_query($var) { /** * Use this function to parse out the query array element from * the output of parse_url(). */ $var = parse_url($var, PHP_URL_QUERY); $var = html_entity_decode($var); $var = explode('&', $var); $arr = array(); foreach($var as $val) { $x = explode('=', $val); $arr[$x[0]] = $x[1]; } unset($val, $x, $var); return $arr; } $url = "http://somefunny.url.com/click?z=26&a=761"; print_r(parse_query($url)); ?> Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now