If I enter the following into the browser:
http://domain.com/script.php?1234
And script.php has the following script:
You could as well do
echo $_SERVER['QUERY_STRING']
As for creating friendly URLs, there are better ways to do it.
See e.g.: $_GET and URL Rewriting for PHP