Skip to content

Instantly share code, notes, and snippets.

@EmeraldCoder
Created July 11, 2013 20:28
Show Gist options
  • Save EmeraldCoder/5978944 to your computer and use it in GitHub Desktop.
Save EmeraldCoder/5978944 to your computer and use it in GitHub Desktop.
Search a value in a array using a case insensitive check
/**
* Search a value in a array using a case insensitive check
* similar to array_search() but case insensitive
*
* @param $search
* @param array $array
*/
private function arraySearchInsensitive($search, array $array)
{
foreach ($array as $key => $value) {
if (stristr($search, $value)) {
return $key;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment