I'm trying to use array_search on a simple array :
echo "<br> Search for : -".ucfirst(strtolower(trim($rowData[0][2]))).'-';
here is the index of the value ( I know it but I want PHP to find it for me >< ):
echo '<br>-'.$listMetiers[0].'-';
Here is the full array :
echo '<pre>';
print_r($listMetiers);
echo '</pre>';
$id_metier = array_search(ucfirst(strtolower(trim($rowData[0][2]))),$listMetiers);
if(!$id_metier)
{
echo ' NOT FOUND !<br>';
$id_metier = -666;
}
else
{
echo 'GOOD : '.$id_metier.'<br>';
}
The value is in the array but array_search don't find it ! Look what I have when executing this code :
What is going on ?

0and!0is ==TRUE, so it enters the if statement; Check if$id_metieris equals FALSE or not