I've got something but still it isn't working like I want it to work.
I've got an array
$values = array(
$aV=>$aP,
$bV=>$bP,
$cV=>$cP,
$dV=>$dP
);
then I sort
it like this ` arsort($values);
the result is Array ( [geel] => 28 [groen] => 20 [rood] => 20 [blauw] => 12 )
Now I want to acces the first / second / tird / fourth element to pass it on
So I want $values[0]
to be the first element. In this case Geel 28
. But if I try to echo $values[0]
it says Undefined offset: 0
(same with 1/2/3 etc). Obviously because I've got no [0]
set but how can I set [0]
to the first element in the array (which is different each time. the value geel
isn't always [0]
but I need the first element (with the lowest number) to be [0]
so I can echo $values[0]
to be the first element of the array with the lowest number