note 60223 added to reserved.variables

From: Date: Fri, 30 Dec 2005 11:38:15 +0000
Subject: note 60223 added to reserved.variables
Groups: php.notes 
Request: Send a blank email to php-notes+get-100984@lists.php.net to get a copy of this message
I made a function for PHP<4.1 to return a global predefined HTTP array, in base of the string between the underscopes. <?php function globals($array) {//$array is a string : SERVER, GET, POST, FILES, ENV, COOKIE, REQUEST, or SESSION. $array = "HTTP_{$array}_VARS"; global $$array; if(isset( $$array )) { return $$array; } else { echo "$array is not a predefined array."; return array(); } } //you can use it to have an array with the same name as the superglobals after PHP 4.1 $_SERVER = globals("SERVER"); ?> ---- Manual Page -- http://www.php.net/manual/en/reserved.variables.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60223 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60223&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60223&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60223&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60223&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60223&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60223&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60223&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60223&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#100984) next »