3 ms·
> my recollection is that PHP tries to pull a strings-are-integer tricks a few times Yeah, the implicit casting in PHP is bonkers, especially when it comes to
by pavel_lishin 6y ago
> my recollection is that PHP tries to pull a strings-are-integer tricks a few times
Yeah, the implicit casting in PHP is bonkers, especially when it comes to comparisons. The comparison table looks like the scribblings of a madman: https://www.php.net/manual/en/types.comparisons.php https://www.php.net/manual/en/types.comparisons.php
(though granted, Javascript acts very similarly.)
- nucleardog 6y agoI have no hate for PHP, it’s been a tool in my toolbox for over a decade, I think it has a lot of good qualities, and it has made me a lot of money. That said, after ten years of use, I still see something like: function_returning_false_or_int() > -1 And sometimes have the wrong intuition about what it does. Now, nobody should write that shit in the first place, but turns out it’s equivalent to ‘!== false’. ‘(int)false’ is zero, but ‘false > -1’... is not true.