// Search a partial string matching in array elements
function array_search_partial($arr, $keyword) {
foreach($arr as $index => $string) {
if (strpos($string, $keyword) !== FALSE)
return $index;
}
}
PHP function array_search(mixed $needle, array $haystack, bool $strict = false) false|int|string
---------------------------------------------------------------------------------------------
Searches the array for a given value and returns the first corresponding key if successful.
Parameters:
mixed--$needle--The searched value.If needle is a string, the comparison is done in a case-sensitive manner.
array--$haystack--The array.
bool--$strict--[optional] If the third parameter strict is set to true then the array_search function will also check the types of the needle in the haystack.
Returns: the key for needle if it is found in the array, false otherwise.
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.