In response to: keith at bifugi dot com
If you want to find the specific key(s) that match the maximum value in an array where the values may be duplicated, you can loop through and perform a simple check:
<?php
$a = array(
'key1' => 100,
'key2' => 90,
'key3' => 100,
'key4' => 90,
);
$max = max($a);
foreach($a as $key => $val) {
if($val === $max) $b[] = $key;
}
$b = implode(' ', $b);
?>
This produces consistent results and will scale well in terms of performance, whereas functions like array_search and array_flip can lead to degraded performance when dealing with large amounts of data.