<?php
$url = "http://www.foo.org?var1=some&var2=more&var3=stuff";
parse_str(parse_url($url, PHP_URL_QUERY), $urlData);
header('Content-Type: text/plain');
print_r($urlData);
// OUTPUT:
/*
Array
(
[var1] => some
[var2] => more
[var3] => stuff
)
*/
You can omit the second parameter to parse_str ("$urlData" in this example) and it will then create separate scalar variables for each value, but this has the potential of name-space clashes if not done carefully.