note 60222 deleted from language.variables.scope by nlopess
| From: | nlopess@php.net | Date: | Fri, 30 Dec 2005 11:39:21 +0000 |
| Subject: | note 60222 deleted from language.variables.scope by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-100985@lists.php.net to get a copy of this message | ||
Note Submitter: Florian
Reason: useless
----
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");
?>