Sometimes you will need to retrieve the GET variables passed into the current page URI or you will have a URL string to work from which contains certain GET variables, the below method helps a lot to convert them into an array which you can easily manipulate later.
$url = $_SERVER[“REQUEST_URI”];
parse_str(parse_url($url, PHP_URL_QUERY), $array);
`$array` is now an array of all the GET variables in the URL.
Alternatively you can pass a URI string in place of the $_SERVER[“REQUEST_URI”] by replacing the `$url` variable with something else.
No need for an example on that one, as I’m sure if you’re already reading this post then you will know what to do.
If all else fails then leave a comment below..