Here is a quick snippet for parsing query strings in PHP. You can use the parse_url
and parse_str
methods. parse_str
will create a variable for you populated with results.
$url = "http://www.seanbehan.com/path/?param=key";
parse_str(parse_url(trim($url))['query'], $qs);
echo $qs;
// returns ['param' => 'key']
Just finishing up brewing up some fresh ground comments...