PHP Get Highest Value from Array

前端 未结 16 1334
耶瑟儿~
耶瑟儿~ 2020-11-28 07:05

I\'m trying to get hold of the largest value in an array, while still preserving the item labels. I know I can do this by running sort(), but if I do so I simply lose the la

16条回答
  •  清酒与你
    2020-11-28 07:43

    greatestValue=> try this its very easy

    $a=array(10,20,52,105,56,89,96);
    $c=0;
    foreach($a as $b)
    {
    if($b>$c)
    $c=$b;
    
    }
    echo $c;
    

提交回复
热议问题