Am 26.06.2019 um 11:09 schrieb Benjamin Morel <[email protected]>:
>
>> "120" > "99.9"; // TypeError
>> Anything else will bring confusion.
>
> Not sure about this, you can do it the JS way: if both operands are
> strings, then it behaves like strcmp():
>
> "23" > "4"; // false
> "23" > "221"; // true
>
> I'm not saying that we should do it, but this would not be confusing to me
> at all.
With the proposed change both
"23" > "4" === true # Current behaviour
and
"23" > "4" === false # New strict behaviour
could be the case depending on a declaration somewhere else in the source code.
That's the confusion Claude and I were talking about: You cannot be sure what a
very simple line of code does.
- Chris
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php