If I enter the following into the browser:
http://domain.com/script.php?1234
And script.php has the following script:
My question is, is this officially correct or it's poor programming?
Query-parameter-without-value is not documented to work, though it probably will continue to in practice.
If you just want to grab the whole query string without parsing it as parameters, the best thing to do would be to say so directly:
echo $_SERVER['QUERY_STRING']
(Whatever you do, don't echo it directly though! Either sanitise the value by eg. converting it to an integer, or, if you want to allow an arbitrary string, output it escaped suitably for JavaScript, by backslash-escaping quotes and backslashes.)