3 ms·
Your example would return true if just the first character was alike. And no, that's not how it works. PHP converts strings that look like numbers into floats a
by kba 14y ago
Your example would return true if just the first character was alike. And no, that's not how it works. PHP converts strings that look like numbers into floats and compares afterwards.
- ctdonath 14y agoWHY? "Hey, this very precise literal has a passing resemblance to another data type, so let's convert it to that, but since it's got too many digits and resembles another data type at this point, let's just throw away some of the data, make the conversion, THEN perform the equality comparison." Yeah, that makes sense. FAIL.
- kba 14y agoI'm not defending PHP. I'm not saying it makes sense. I'm just saying that's what's happening.