When 0 == absolutely-any-value-in-the-world in PHP
bugs.php.net
bugs.php.net
$haystack = array('absolutely-any-value-in-the-world');
if ( in_array($needle, $haystack) ) {
echo "I've heard of loose comparison but this might be a little excessive.";
}
Note: I submitted it as a bug on php.net and the response was...
"Fundamental bugs are easy to find when you don't read the documentation."
(Just in case this isn't clear, it was closed as NOT being a bug within 10 mins of submitting.)
Of course I did read the docs and was aware of the strict comparison but I don't want strict comparison I just want it to work as expected, ie the value on the left matches the value in an array as long as it looks the same. So I would expect.. 0 to match '0', or 12345 to match '12345' but would not expect 0 to match any string value.
dammit PHP...