RE: [PHP] Creating my own super global variables
| From: | Siddharth Hegde | Date: | Mon, 24 Feb 2003 17:29:07 +0000 |
| Subject: | RE: [PHP] Creating my own super global variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-136948@lists.php.net to get a copy of this message | ||
U'r 100% right Mr Ernest.
- Siddharth
> -----Original Message-----
> From: Ernest E Vogelsinger [mailto:ernest@vogelsinger.at]
> Sent: Monday, February 24, 2003 10:45 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Creating my own super global variables
>
> 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/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php