note 30333 added to language.variables.predefined
| From: | debabratak at softhome dot net | Date: | Fri, 14 Mar 2003 09:59:45 +0000 |
| Subject: | note 30333 added to language.variables.predefined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45293@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/language.variables.predefined.php
http://master.php.net/manage/user-notes.php?action=edit+30333
http://master.php.net/manage/user-notes.php?action=delete+30333
http://master.php.net/manage/user-notes.php?action=reject+30333