Re:PHP WTF: A PHP Annoyance Posted Every Day
by Deestan on Friday June 19, 2009 @10:08AM
(#665132)
So:
results in
Does anyone know the technical reasons for this?
[ Parent
| on HN ]
daeken explained it quite well. From his post:
"As explained under 'read more', it's because 'test' will be cast to a number for comparison. Since 'test' isn't a number, it becomes 0, which is equivalent."
These tables illustrate how complicated type checking in PHP really is: http://www.php.net/manual/en/types.comparisons.php