Searches the array for a given value and returns the key
by sabitha[ Edit ] 2012-06-05 14:22:11
Searches the array for a given value and returns the key
array_search - This function searches the array for a given value and returns the key if found
$myarr = array(0=>"apple", 1=>"orange", 2=>"banana", 3=>"orange");
$res = array_search('orange', $myarr);
print_r($res);
will outputs
1