When I want to check if something is in the array and get the key back, I use the array_search() function.
Why is it when I compare the function to be exactly equal to true (=== true) it returns false, and when I compare it to not be exactly equal to false (!== false) it returns true?
<?php
if(array_search($value, $array) === true)
{
// Fails
}
if(array_search($value, $array) !== false)
{
// Succeeds
}
?>
Thanks in advance.
array_search returns you needle when a match is found. it returns false only when match is not found. This is why only the opposite works in your case.