note 31772 added to language.variables.predefined

From: Date: Sat, 03 May 2003 00:26:06 +0000
Subject: note 31772 added to language.variables.predefined
Groups: php.notes 
Request: Send a blank email to php-notes+get-47410@lists.php.net to get a copy of this message
For those of us who don't have the luxery of upgrading to the latest version of PHP on all of the servers we use but want to use the same variable names that are used in the latest version for super global arrays here's a snippet of code that will help: // Makes available those super global arrays that are made available // in versions of PHP after v4.1.0. if (isset ($HTTP_SERVER_VARS)) { $_SERVER = &$HTTP_SERVER_VARS; } if (isset ($HTTP_GET_VARS)) { $_GET = &$HTTP_GET_VARS; } if (isset ($HTTP_POST_VARS)) { $_POST = &$HTTP_POST_VARS; } if (isset ($HTTP_COOKIE_VARS)) { $_COOKIE = &$HTTP_COOKIE_VARS; } if (isset ($HTTP_POST_FILES)) { $_FILES = &$HTTP_POST_FILES; } if (isset ($HTTP_ENV_VARS)) { $_ENV = &$HTTP_ENV_VARS; } if (isset ($HTTP_SESSION_VARS)) { $_SESSION = &$HTTP_SESSION_VARS; } The only downfall to this is that there's no way to make them super global. Chances are, though, if you're using a lot of global arrays in your code you should consider a code redesign! :) Hope this helps. -- http://www.php.net/manual/en/language.variables.predefined.php http://master.php.net/manage/user-notes.php?action=edit+31772 http://master.php.net/manage/user-notes.php?action=delete+31772 http://master.php.net/manage/user-notes.php?action=reject+31772

« previous php.notes (#47410) next »