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)); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.