|
Posted by Toby A Inkster on 07/15/07 19:58
Michael Fesser wrote:
> Didn't test it, but according to the manual it should work
It will work, yes, but it's unwise, as you'd be skating on very thin ice.
echo $foo[bar];
echo "{$foo[bar]}";
will both use the constant 'bar' instead of the string 'bar' if it exists.
It's very easy to slip up in this area, so safer to always quote strings
used as array indices.
PHP is known to change its syntax from time to time, and may well become
less forgiving in the future with regard to something like:
echo "$foo[bar]";
and I'd imagine such a bug may be very tricky to track down.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 24 days, 23:34.]
demiblog 0.2.0 Released
http://tobyinkster.co.uk/blog/2007/06/28/demiblog-0.2.0/
Navigation:
[Reply to this message]
|