|
Posted by Rik on 10/18/06 01:38
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));
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|