Looking For Anything Specific?

ARRAY_SEARCH



1.      ARRAY_SEARCH
array_search — Searches the array for a given value and returns the corresponding key if successful
Description
mixed array_search ( mixed $needle, array $haystack [, bool $strict] )
Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise.
Note: If needle is a string, the comparison is done in a case-sensitive manner.
If the optional third parameter strict is set to TRUE then the array_search() will also check the types of the needle in the haystack.
If needle is found in haystack more than once, the first matching key is returned. To return the keys for all matching values, use array_keys() with the optional search_value parameter instead.
Example. array_search() example
'blue', 1 => 'red', 2 => 'green', 3 => 'Red'); $key = array_search('green', $array); // $key = 2; echo $key; $key = array_search('Red', $array, true); // $key = 3; echo $key; ?>