I’m aware of this method:
stackoverflow.com/?id=stack
<?php
echo $_GET['id'];
//output: stack
?>
But I would like to know how to get $_GET request if url is like this:
stackoverflow.com/?stack
<?php
echo ???
//output: stack
?>
Notice that content after /? is dynamically changed.
You can get the whole query string (unparsed) with
$_SERVER['QUERY_STRING']