Den fre. 15. mar. 2019 kl. 17.06 skrev Nikita Popov <nikita....@gmail.com>: > I'm okay with this. This syntax has already been deprecated once, though it > was reverted for reasons I don't remember. > > There are some people using this syntax to distinguish between array and > string access. It's a nice thought, but as the vast majority of code > doesn't make this distinction (I think the only time I saw this in recent > years was inside some old PEAR code), it's not really a useful indicator.
I personally use it because I like to quickly tell if I am doing an operation on a string or array, it is eye candy and makes a lot of sense. I think if anything the two syntaxes should be decoupled instead. >From a usage PoV, then from personal experience (outside my own projects), I have seen many usages of this syntax, even as late as my current company with a growing codebase that is nearing 1.1m LoC, I have seen this syntax used countless of times. In fact I don't think I have been working with a code base where I have not seen this syntax used. I have asked fellow developers around in my community today and they have no strong opinion on either, but do like the distinction between. > The rarity of its use also makes it rather confusing. While $foo[$x] is > well established as an array or string offset (or for that matter, > ArrayObject) access and will be recognized by any programmer coming from > any number of programming languages, $foo{$x} certainly is not, and is a > WTF moment for people who don't happen to personally use this syntax. > > I'd prefer to phase out this syntax entirely and not reuse it for any other > purpose. Reusing syntax is generally a not so good idea, because it means > that the same syntax has different meaning in different PHP version. For me personally it is a huge -1, if anything I would like the string[] syntax decoupled. -- regards, Kalle Sommer Nielsen ka...@php.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php