Hacker News new | past | comments | ask | show | jobs | submit login

So:

  0 == 'x'
results in

  bool(true)
Does anyone know the technical reasons for this?



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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: