[ $a = 'foo'; $a['bar'] = 42; has an even weirder behaviour: It results in the string '4oo'... ]
That's a pretty. It is using 'bar' as a sting index to 'foo' and to do this it needs to convert 'bar' to an integer. The rest is obvious.
So you find it obvious that 42 is cast to string and the first character is used as replacement? Wasn't obvious to me before I tried it :-)
I think we should make [] as string offset an E_STRICT or even E_ERROR because it confuses far too many people especially since we generally
E_ERROR would be a big BC break I guess. E_STRICT sounds fine to me.
- Chris
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php