I am beginner in PHP and i read in manual that $_REQUEST is a associative array consisting of cookies, get and post arrays. I want to know which takes precedence in request array.
Say, suppose i have a variable user in $_POST as well as $_COOKIE, and if i use echo $_REQUEST['user'] then which would print. I tried it and i get the value set in $_POST. If i want to print value of $_COOKIE what should i use? I know $_COOKIE is there but still using $_REQUEST if i want to print it, then how should i do it?
Thanks in advance 🙂
From the PHP manual on
$_REQUEST(php.net):In fact PHP uses the
request_orderconfig value, but falls back onvariables_orderif empty.A possible value for request or variables order might look like this:
"GPC". This means that first all Get variables are associated, then the Post- and after that the Cookie variables are associated. The order is from left to right, already defined values are overwritten. Except from GET, POST and cookie values, PHP can also associate environment ("E") and server ("S") variables.You’ll find the corresponding manual entries for the PHP config here.