note 91239 added to language.variables.variable

From: Date: Mon, 01 Jun 2009 09:36:21 +0000
Subject: note 91239 added to language.variables.variable
Groups: php.notes 
Request: Send a blank email to php-notes+get-156212@lists.php.net to get a copy of this message
Parsing and retrieving a value from superglobals, by a specified order, looping until it find one : function GetInputString($name, $default_value = "", $format = "GPCS") { //order of retrieve default GPCS (get, post, cookie, session); $format_defines = array ( 'G'=>'_GET', 'P'=>'_POST', 'C'=>'_COOKIE', 'S'=>'_SESSION', 'R'=>'_REQUEST', 'F'=>'_FILES', ); preg_match_all("/[G|P|C|S|R|F]/", $format, $matches); //splitting to globals order foreach ($matches[0] as $k=>$glb) { if ( isset ($GLOBALS[$format_defines[$glb]][$name])) { return $GLOBALS[$format_defines[$glb]][$name]; } } return $default_value; } ---- Server IP: 69.147.83.197 Probable Submitter: 82.78.28.76 ---- Manual Page -- http://www.php.net/manual/en/language.variables.variable.php Edit -- https://master.php.net/note/edit/91239 Del: integrated -- https://master.php.net/note/delete/91239/integrated Del: useless -- https://master.php.net/note/delete/91239/useless Del: bad code -- https://master.php.net/note/delete/91239/bad+code Del: spam -- https://master.php.net/note/delete/91239/spam Del: non-english -- https://master.php.net/note/delete/91239/non-english Del: in docs -- https://master.php.net/note/delete/91239/in+docs Del: other reasons-- https://master.php.net/note/delete/91239 Reject -- https://master.php.net/note/reject/91239 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#156212) next »