Hacker News new | ask | show | jobs
by ebbv 4633 days ago
Not unique to PHP in any way shape or form.
1 comments

Perhaps not, but PHP certainly makes it unusually easy.
I know this is a popular idea, but it's pretty easy to write terrible code in any language. See: most code.
Yes, 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)
We 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-whi...

Seriously? (string) x fuzzy equals to (int) 0? Holy crap that is some cancer.
I'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 ==.

"PHP: It's worse than ColdFusion."
Just tried it... yep.

Though I suppose you could use === but it's still crazy.