RE: [PHP] What am I not understanding about $GLOBALS['myvar'] vs global $myvar?

From: Date: Wed, 26 Mar 2003 22:01:24 +0000
Subject: RE: [PHP] What am I not understanding about $GLOBALS['myvar'] vs global $myvar?
Groups: php.general 
Request: Send a blank email to php-general+get-141127@lists.php.net to get a copy of this message
I think you either want to use no quotes or double quotes, but not single quotes. Double quotes will interpolate the variable, single quotes will not, i.e. $key becomes a string literal rather than a variable. No quotes will work, although the docs seem to indicate it is deprecated syntax. Not everyone agrees that it is deprecated, though ;) Kirk > $GLOBALS[$key] is incorrect and depricated AFAIK. > $GLOBALS['$key'] (with the single quotes) is the proper way > to write these > types of associative arrays/hashs.

« previous php.general (#141127) next »