note 84527 added to reserved.variables.request

From: Date: Thu, 17 Jul 2008 15:04:22 +0000
Subject: note 84527 added to reserved.variables.request
Groups: php.notes 
Request: Send a blank email to php-notes+get-141629@lists.php.net to get a copy of this message
Don't forget, because $_REQUEST is a different variable than $_GET and $_POST, it is treated as such in PHP -- modifying $_GET or $_POST elements at runtime will not affect the ellements in $_REQUEST, nor vice versa. e.g: <?php $_GET['foo'] = 'a'; $_POST['bar'] = 'b'; var_dump($_GET); // Element 'foo' is string(1) "a" var_dump($_POST); // Element 'bar' is string(1) "b" var_dump($_REQUEST); // Does not contain elements 'foo' or 'bar' ?> If you want to evaluate $_GET and $_POST variables by a single token without including $_COOKIE in the mix, use $_SERVER['REQUEST_METHOD'] to identify the method used and set up a switch block accordingly, e.g: <?php switch($_SERVER['REQUEST_METHOD']) { case 'GET': $the_request = &$_GET; break; case 'POST': $the_request = &$_POST; break; . . // Etc. . default: } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 76.2.3.4 ---- Manual Page -- http://www.php.net/manual/en/reserved.variables.request.php Edit -- https://master.php.net/note/edit/84527 Del: integrated -- https://master.php.net/note/delete/84527/integrated Del: useless -- https://master.php.net/note/delete/84527/useless Del: bad code -- https://master.php.net/note/delete/84527/bad+code Del: spam -- https://master.php.net/note/delete/84527/spam Del: non-english -- https://master.php.net/note/delete/84527/non-english Del: in docs -- https://master.php.net/note/delete/84527/in+docs Del: other reasons-- https://master.php.net/note/delete/84527 Reject -- https://master.php.net/note/reject/84527 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141629) next »