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
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now