3 ms·
Not unique to PHP in any way shape or form.
by ebbv 13y ago
Not unique to PHP in any way shape or form.
- TylerE 13y agoPerhaps not, but PHP certainly makes it unusually easy.
- ebbv 13y agoI know this is a popular idea, but it's pretty easy to write terrible code in any language. See: most code.
- TylerE 13y agoYes, but, in most langauges, this doesn't work <?php $a = 0; $b = 'x'; var_dump(FALSE == $a); var_dump($a == $b); var_dump($b == TRUE); ?> This results in bool(true) bool(true) bool(true)
- babby 13y agoSeriously? (string) x fuzzy equals to (int) 0? Holy crap that is some cancer.
- TylerE 13y agoYes, seriously. http://php.net/manual/en/types.comparisons.php http://php.net/manual/en/types.comparisons.php
- sjwright 13y ago"PHP: It's worse than ColdFusion."
- krapp 13y agoThat's just... that's just cruel.
- sjwright 13y agoAs a CFML developer who has had to bear the brunt of gleeful derision, you won't get an apology from me. :-) Modern CFML running on Railo is an awesome environment to work in: PHP-like hackability, a very consistent language spec, native JVM performance, first-class java library integration, and it's a 100% pure open source software stack. Whereas PHP has a much slower runtime, a horrific language spec, and nothing similar to the benefit of running on a common runtime like the JVM.
- NegativeK 13y agoI've no certainty here, but I strongly suspect that it's a Perlism that PHP partially took. In Perl, $a == $b would be true -- just like in PHP. However, in Perl, you use string comparison ($a eq $b) when you want to compare strings. PHP doesn't seem to have string comparison outside of ==.
- krapp 13y agoJust tried it... yep. Though I suppose you could use === but it's still crazy.
- yareally 13y agoWe might as well mention JavaScript's hangups with using == instead of === if we're going to drag out PHP's. http://stackoverflow.com/questions/359494/does-it-matter-which-equals-operator-vs-i-use-in-javascript-comparisons http://stackoverflow.com/questions/359494/does-it-matter-whi...