to add that $GLOBALS has reference to itself but when used in non-function context. 
Try <?php var_dump($GLOBALS);?> and <?php
function a(){ var_dump($GLOBALS); } a(); ?>

Regards,
Andrey Hristov

----- Original Message -----
From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
To: "Hunter, Ray" <[EMAIL PROTECTED]>
Cc: "Richard Davey" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, March 13, 2002 7:09 PM
Subject: RE: [PHP] How to access arrays from $GLOBAL?


> I am not sure there is any.  $GLOBALS is simply an array that contains
> individual references to each global variable.
>
> For example:
>
>   $a = 1;
>   $GLOBALS['a'] = 2;
>   echo $a;
>
> gives you 2
>
> The best documentation is probably the basic explanation of how references
> work.  http://php.net/references
>
> -Rasmus
>
> On Wed, 13 Mar 2002, Hunter, Ray wrote:
>
> > Where is some good documentation on how $GLOBALS works and what is really
> > going on in the background?
> >
> >
> > Thank you,
> >
> > Ray Hunter
> > Firmware Engineer
> >
> > ENTERASYS NETWORKS
> >
> >
> > -----Original Message-----
> > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, March 13, 2002 9:53 AM
> > To: Richard Davey
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] How to access arrays from $GLOBAL?
> >
> >
> > I don't understand why you think it is illogical.  How else would you
> > dereference a multi-dimensional array?
> >
> > On Wed, 13 Mar 2002, Richard Davey wrote:
> >
> > > "Mike Ford" <[EMAIL PROTECTED]> wrote in message
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED].
> > > ..
> > > > $GLOBALS['mtxt'][1]
> > >
> > > Fantastic :)
> > >
> > > That's totally illogical but it works a treat.
> > > PHP has some weird syntax rules sometimes!
> > >
> > > Cheers,
> > >
> > > Rich
> > > --
> > > Fatal Design
> > > http://www.fatal-design.com
> > > Atari / DarkBASIC / Coding / Since 1995
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to