3 ms·
To anybody not familiar with PHP, it appears to fail at string comparison.
by bonzoesc 15y ago
To anybody not familiar with PHP, it appears to fail at string comparison.
- zdouglas 15y agoArguably, such an obtuse implicit cast is failure at string comparison.
- ctdonath 15y agoAppears? It DOES fail at string comparison. They're strings. You can't make it any plainer that they're strings. Sometimes, like with barcode processing, strings contain only numeric characters - they're still strings regardless. If I can't ask if one string literal is equal to another string literal without it making a concerted effort to not just convert both strings to integers (which, BTW, would be fine so long as it preserved all digits) but to then convert it from a non-lossy to a lossy data type - that's TWO unwarranted type conversions - then the axioms of the language are untenable, rendering it useless in the real world and making it little more than a toy. If you're going to run with PHP's axioms, then the specifications should (1) demand an unlimited-length integer type, and (2) NEVER convert a non-lossy to lossy data type without very good overt reason. Fail.