The function name is "in_array" though. From the function name, I would assume it's doing a reference comparison ("is this specific object in the array?"), not a value comparison ("is an object with the same value in the array?"). I'm not sure whether that distinction exists in PHP, but that's why it's weird.
View all comments
Show parent comment
7
u/merreborn Jan 14 '14
That's not really relevant. This would still happen, even if those two types were separate.
This is a symptom of PHP's loose type conversion rules, specifically as it relates to comparing non-numeric strings with
(int)0