Re: PHP globals aren't really globals

From: Date: Wed, 14 Feb 2001 15:50:53 +0000
Subject: Re: PHP globals aren't really globals
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39650@lists.php.net to get a copy of this message
> I believe you use globals $var to ACCESS a global variable, not to > define. That's correct. To be perfectly correct here, what you are doing is creating a reference to the global variable. Think of it as an alias to the same variable as the global variable. global $foo; would be equivalent to: $foo = & $GLOBALS['foo']; With the latter giving you the ability to use a different name for the local reference to the globally-scoped variable. -Rasmus

« previous php.general (#39650) next »