Is the order of the keys-value pairs in the $_GET superglobal variable guaranteed to be consistent with how the field-value pairs were received in the requested URL?
For example, given this URL request received by the web server:
index.php?a=1&foo=bar&b=2
...and this code:
foreach ($_GET as $key => $value)
{
echo $key . ": " . $value\n";
}
...will the result always be guaranteed to be:
a: 1
foo: bar
b: 2
I didn't see any mention of key ordering in the PHP doc of $_GET or superglobals in general. This leads me to believe that the order of the key-value pairs cannot be relied upon.
Does anyone know if the order has a guaranteed consistency to it, or better yet point to spec/doc that clarifies this?
It is best to assume that they are not reliable for two reasons. First, this is not documented. Things which are not documented are subject to change without notice... because if they never notified you the first time, why do the need to now? Second, you can't be 100% positive that the client won't somehow mung the data.