Voting

: min(seven, eight)?
(Example: nine)

The Note You're Voting On

michaelangel0 at mail.com
17 years ago
Matlab users and others may feel lonely without the double argument output from min and max functions.

To have the INDEX of the highest value in an array, as well as the value itself, use the following, or a derivative:

<?php
function doublemax($mylist){
$maxvalue=max($mylist);
while(list(
$key,$value)=each($mylist)){
if(
$value==$maxvalue)$maxindex=$key;
}
return array(
"m"=>$maxvalue,"i"=>$maxindex);
}
?>

<< Back to user notes page

To Top