The following does not work anymore in 1.9 (at least when it was released, who knows if they reverted the change):
{"a", "b"}
And there were plenty of gems and small scripts online I was able to get working just fine under 1.8.7 but not 1.9. Thankfully that is largely no longer the case, as things have been updated or replaced.
String class was also given a nice kick in the ass, at least in regards to iteration.
Would you say that these were not backwards incompatible changes? Code that worked before stopped working. Breaks BC in my book. And in both cases the changes were arguably for the better.
- Stop writing code with uninitialized variables
- Stop iterating over stuff that shouldn't be iterated over in that way
As far as why the changes were thus, it was decided to destroy PHP 6 - do people still write books about that? - and port every change other than unicode support down to 5.x. Someone feel free to correct me on that point.
It doesn't work in the latest 1.9 either. It was a bizarre syntax that hardly anyone used from my experience (I've been a library-oriented Rubyist for several years and never saw it in production code.)
However, String is a good point, and especially around character encodings. Not to mention threads, major stdlib changes, enumerators, and more..
The again, in PHP, interpreting strings as floats is not unusual and pretty well defined. So in PHP it's also a case the developer could have considered normal in his expectation that PHP would behave as usual (and it did, prior to 5.3, for this precise function)
Not what for user-provided input? The source of a string does not matter to this rule of PHP: a string used in numeric context will be parsed and converted, if it can not be parsed as a number its numeric value will be 0. That's it. That's how the language defines strings in numeric contexts.
> That's just a dumb thing to do in any language.
Sure, you won't get any argument from me on that, but that remains how PHP works and has always worked.
String class was also given a nice kick in the ass, at least in regards to iteration.
Would you say that these were not backwards incompatible changes? Code that worked before stopped working. Breaks BC in my book. And in both cases the changes were arguably for the better.
- Stop writing code with uninitialized variables - Stop iterating over stuff that shouldn't be iterated over in that way
As far as why the changes were thus, it was decided to destroy PHP 6 - do people still write books about that? - and port every change other than unicode support down to 5.x. Someone feel free to correct me on that point.