To expand on previous comments, here are some examples of
where using array_search within an IF statement can go
wrong when you want to use the array key thats returned.
Take the following two arrays you wish to search:
<?php
$fruit_array = array("apple", "pear", "orange");
$fruit_array = array("a" => "apple", "b" => "pear", "c" => "orange");
if ($i = array_search("apple", $fruit_array))
if (is_numeric($i = array_search("apple", $fruit_array)))
if ($i = is_numeric(array_search("apple", $fruit_array)))
if ($i = array_search("apple", $fruit_array) !== FALSE)
if (($i = array_search("apple", $fruit_array)) !== FALSE)
?>