I just saw this code while studying the wordpress source code (PHP), You can see they mergre/turn all get and post values into 1 request array.
Now as I know it, $_GET and $_POST are already available by calling $_REQUEST WITHOUT using the array_merge() function, so any ideas why they would do this?
$_REQUEST = array_merge($_GET, $_POST);
That is because the default $_REQUEST
is a merger of $_GET
, $_POST
AND $_COOKIE
. Also, the order in which the variables of these superglobals are merged into $_REQUEST
is dependant on the ini setting variables_order
and as of PHP 5.3.0 can also be influenced by request_order
.
So my guess is, that the developer wanted to make sure $_REQUEST
consists of only $_GET
and $_POST
, merged in that particular order, if he didn't have access to ini settings (on a shared host for instance). You see, variables_order
and request_order
aren't configurable on a per script basis.
HTH