Hacker News new | ask | show | jobs
by bndr 4632 days ago
I'm actually the one that wrote the last two nasty parts of code, not the author himself. I'm really sorry that it confused you.

I actually don't remember why I wrote them like that, but I'm pretty sure I had a reason (at least I think I do..)

Again, sorry about that.

1 comments

And this is how PHP hell begins.
Not unique to PHP in any way shape or form.
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.
Just tried it... yep.

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

Please elaborate. :(
You wrote nasty code in PHP that you don't clearly understand, and aren't immediately either researching (and then documenting!) why you did what you did, or failing that, recoding for sanity. Once those little hacks calcify it's all down the tubes from there.
And this is how HN threads get derailed and ruined. Your comment is valueless, please consider deleting it.