Skip to content

Instantly share code, notes, and snippets.

@ajace
Created December 18, 2013 20:42
Show Gist options
  • Save ajace/8029523 to your computer and use it in GitHub Desktop.
Save ajace/8029523 to your computer and use it in GitHub Desktop.
PHP: array keys search for insensitive input
function array_keys_i($array, $str){
$results = array();
foreach($array as $key => $value) {
if(stristr($str,$value)) {
$results[] = $key;
}
}
if(empty($results)) {
return false;
} else {
return $results;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment