A variation of previous searches that returns an array of keys that match the given value:
<?php
function array_ksearch($array, $str)
{
$result = array();
for($i = 0; $i < count($array); next($array), $i++)
if(strtolower(current($array)) == strtolower($str))
array_push($result, key($array);
return $result;
}
?>
Usage would be as follows:
<?php
$testArray = array('one' => 'test1', 'two' => 'test2', 'three' => 'test1', 'four' => 'test2', 'five' => 'test1');
print_r(array_ksearch($testArray, 'test1'));
?>