On Tue, Dec 27, 2011 at 2:15 PM, Dmitri Snytkine < dsnytk...@ultralogistics.com> wrote:
> No sure who can and cannot vote, I don't see any way for me to vote. > https://wiki.php.net/rfc/voting currently the following two groups can vote: - people having php.net svn account - people having a wiki account and manually granted with the voters group membership > > My opinion that it’s a good idea to have array and string dereference. > One feature however, looks odd, like it does not belong here: > echo "foobar"["foo"][0] // output f > > Does it look odd to anyone else? I mean, this sort of thing can be added > but it just looks like a separate feature alltogether. > which part seems odd to you? this rfc and the proposed patch doesn't introduce any new behavior, just allows using "foobar" everywhere where you could use $foobar = "foobar" I guess you found it odd that $foobar = "foobar"; echo $foobar["foo"]; prints 'f', but that's not a new feature, this is how php works currently. we had a discussion about that recently, and AFAIK in the latest 5.4, a warning will be triggered if you try to reference a string offset using a string index. the scalar referencing proposed here should (and AFAIK it does) behave exactly the same as it would work if a variable with the same value would be used. -- Ferenc Kovács @Tyr43l - http://tyrael.hu