|
Posted by Geoff Muldoon on 10/18/06 02:05
luiheidsgoeroe@hotmail.com says...
> jayipee@gmail.com wrote:
> > hi to all. can anybody help me figuring out how to get the minimum
> > value from this list.
> >
> > log1 354
> > log2 232
> > log3 155
> >
> > from the above list i want to have a return value "log3" since this is
> > the lowest value in the list.
> >
> > I tried to use $test = min(array('log1' => 354,'log2' => 232,'log3' =>
> > 155));
> > but it returns only the value 155 and not log3
> >
> > i would be very glad if someone can help me.
>
> $array = array('log1' => 354,'log2' => 232,'log3' => 155);
> asort($array);
> $min_key = reset(array_keys($array));
or:
$log_array = array("log1"=>354, "log3"=>155, "log2"=>232);
arsort($log_array);
$log_array = array_flip($log_array);
echo array_pop($log_array);
Geoff M
Navigation:
[Reply to this message]
|