Re:An Internet of PHP
by xigoi on Saturday September 09, 2023 @12:44PM
(#37447333)
Because now the behavior of comparison depends on whether the string looks like a number.
[ Parent
| on HN ]
Arguably 48 == "48" should be true. If this doesn't work for you, stick to ===.
Thank you, I'll stick to languages where you can't just compare numbers and strings without an explicit conversion.
Also, should 48 == "48.0" be true? How about "048", "48.", "0x30", " 48 ", "48foo", "3*16", "XLVIII", "forty-eight"?
Once again: just use ===
If you decide languages based on minutiae like this, I can only pity you.
=== works for equality (if you actually remember to use it), but how about comparison? There's no strict version of <.