note 30333 deleted from language.variables.predefined by curt
| From: | curt@php.net | Date: | Tue, 06 Jul 2004 03:02:31 +0000 |
| Subject: | note 30333 deleted from language.variables.predefined by curt | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72660@lists.php.net to get a copy of this message | ||
Note Submitter: debabratak@softhome.net
----
After having register_globals = off, I am using the following piece of code to get all the variables
created for me. I have put this code in a separate file and just make it require_once() on top of
every page.
session_start();
$ArrayList = array("_GET", "_POST", "_SESSION", "_COOKIE",
"_SERVER");
foreach($ArrayList as $gblArray)
{
$keys = array_keys($$gblArray);
foreach($keys as $key)
{
$$key = trim(${$gblArray}[$key]);
}
}
This pulls out all the possible variables for me, including the predefined variables, so I can keep
coding the old style. Note that, this code does not handle the $_FILE.
Hope this helps someone.