Quando hai delle funzioni che possono ritornare un valore a 0, come in questo caso, nella condizione non devi usare l'operatore "==" ma "===".

Su php.net è ben evidenziata la problematica.

http://php.net/manual/en/function.array-search.php

Warning

This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function.