Searching an array
Searching for a value in an array is made simple using the function array_search(). If the keyword is found in the array, then the corresponding key of that value is retured for further operations.
PHP Code:
<?
$months = array(1=>"Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug",
"Sep", "Oct", "Nov", "Dec");
$key = array_search("May", $months); //Searching for May in months array
echo $key;
// We can also print the value that key points at
echo $months[$key];
?>