> Call for voting about the const array/string derefernce RFC now. > > you can find more info here: > https://wiki.php.net/rfc/constdereference#vote
I have always wondered why array dereference does not just work on arbitrary expressions in PHP like other operators do. Even with the latest modification that allows dereferencing function calls, this works: md5('')[0] but this results in a parse error (syntax error, unexpected '['): (md5(''))[0] Then there are expressions like ('a'.'b')[0], all sorts of combinations of operators... Why not just treat any 'expression[expression]' as an array dereference as other languages do? >> echo "foobar"["foo"][0]; > > "foobar"["foo"] - Why not "undefined index"? "foo" is converted to an integer, yielding zero. 'Undefined index' seems to make more sense to me but PHP 5.3 behaves the same way. -- Oleg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php