Re: Globals

From: Date: Fri, 01 Aug 2003 19:19:23 +0000
Subject: Re: Globals
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-157994@lists.php.net to get a copy of this message
Maybe it has to do with the fact that the $GLOBALS[] array has a copy of itself inside the parent. kinda weird but it looks like this $GLOBALS['key1'] = 'value1'; $GLOBALS['key2'] = 'value2'; $GLOBALS['GLOBALS']['key1'] = 'value1'; $GLOBALS['GLOBALS']['key2'] = 'value2'; don't ask me why, but it seems odd to me to do this. A little redundant if you ask me. Jim Lucas ----- Original Message ----- From: "Chris Boget" <chris@wild.net> To: "PHP General" <php-general@lists.php.net> Sent: Friday, August 01, 2003 12:17 PM Subject: Re: [PHP] Globals > > > I'm curious if someone could explain to me why this is occuring: > > > > function blah() { > > //global $GLOBALS; > > echo 'Globals: <pre>'; print_r( $GLOBALS ); echo '</pre>'; > > > > } > > > > As it is shown above, with the 'global $GLOBALS' line commented > > out, the print_r() works and shows all the currently defined variables > > and their corresponding values. However, if I declare $GLOBALS > > as global, nothing gets printed out. > > > > Why? > > The above is all I really need to know. The rest of my previous email > was the result of a massive brainfart. > Sorry about that... > > Chris > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#157994) next »