I made this function named "array_getMax" that returns te maximum value and index, from array:
<?php
function array_search_all($needle, $haystack)
{foreach ($haystack as $k=>$v) {
if($haystack[$k]==$needle){
$array[] = $k;
}
}
return ($array);
}
function array_getMax($array){
$conteo=array_count_values($array);
if( count($conteo)==1 ){return $array;
}
arsort($array);
$maxValue=null;
$keyValue=null;
foreach($array as $key=>$value){
if($maxValue==null){
$maxValue=$value;
$keyValue=$key;
break;
}
}
$resultSearch=array_search_all($maxValue, $array);
return array_fill_keys($resultSearch, $maxValue);
}
$arreglo=array('e1'=>99,'e2'=>'99','e3'=>1,'e4'=>1,'e5'=>98);
var_dump(array_getMax($arreglo));
?>
I hope some one find this usefull