However, String is a good point, and especially around character encodings. Not to mention threads, major stdlib changes, enumerators, and more..
I find it much more irritating when the behaviour subtly changes and introduces edge cases that may not be picked up in testing / normal usage.
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.
php> echo "2coolforschool" + 1;
3
php> echo "2.1coolforschool" + 1;
3.1
php> echo "coolforschool" + 1;
1
So treating all kinds of garbage as valid numbers is absolutely part of PHP.
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.