Re: Creating my own super global variables

From: Date: Mon, 24 Feb 2003 17:14:41 +0000
Subject: Re: Creating my own super global variables
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-136946@lists.php.net to get a copy of this message
At 17:54 24.02.2003, Jason Wong spoke out and said: --------------------[snip]-------------------- >On Tuesday 25 February 2003 00:07, Siddharth Hegde wrote: > >> Is there any way I can creat my very own super global variables? > >All variables defined in the global scope can be accessed via $GLOBALS. > >So: > > $my_very_own_variable = 'whatnot'; > >can be accessed anywhere as: > > $GLOBALS['my_very_own_variable'] > >For consistency you might want to always refer to it as >$GLOBALS['my_very_own_variable'], so: > > $GLOBALS['my_very_own_variable'] = 'whatnot'; --------------------[snip]-------------------- Yes, but the question was for a "superglobal", like $_REQUEST, $_POST, $_GET, or $_SERVER, so he wants something like $_MYSUPERGLOBAL which is not possible afaik. If you have a look in main/main.c, there's an array called "short_track_vars_names" at the very beginning, which is later on looped and tits contents passed to zend_register_auto_global(), which in turn adds the name to a hash structure for autoglobal identifier lookup. These names are hardcoded and cannot be changed (except when you modify the distribution source code and recompile). -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#136946) next »