Case insensitive in_array
Function in_array()
is case sensitive - which is not always what you want.
Sometimes you need to search an array, and you don’t
care about the case of its elements:
function in_arrayi($needle, $haystack) { return in_array(strtolower($needle), array_map('strtolower', $haystack), true);}
Example:
$array = array('a', 'B', 'cE');
in_arrayi('a', $array); // truein_arrayi('A', $array); // truein_arrayi('ce', $array); // truein_arrayi('be', $array); // false