Reasoning behind using quotes for associative array element acces s?

From: Date: Fri, 11 Aug 2000 20:53:50 +0000
Subject: Reasoning behind using quotes for associative array element acces s?
Groups: php.general 
Request: Send a blank email to php-general+get-11407@lists.php.net to get a copy of this message
What's the purpose of having $myarray["element"] be legal, while $myarray[element] is "illegal"? When I was first learning PHP, I did it the Perl way, without the quotes. I have since discovered that this is "bad", but I don't understand why. It works both ways (albeit with a warning if error reporting is turned up above the default), and so I can do something like $myarray["value$num"] if necessary, but most of the time, $myarray[element] is quicker. Any hazards of doing it w/o quotes? Ideas? Rasmus? Zeev? --Bruce Bruce Christensen Intel Corporation brucex.r.christensen@intel.com

« previous php.general (#11407) next »