I have an array that looks like this:
Array
(
[90] => Array
(
[1056] => 44.91
[1055] => 53.56
[1054] => 108.88
[1053] => 23.28
),
[63] => Array
(
[1056] => 44.44
[1055] => 53.16
[1054] => 108.05
),
[21] => Array
(
[1056] => 42.83
[1055] => 51.36
[1054] => 108.53
)
);
Both keys ([x] and [y]) relate to identifiers in my database, so they should remain intact. The order [x] does not matter, but I need to sort each array by the value [y].
Edit:
I tried this loop, but it does not work:
foreach($distance as $key=>$value) {
asort($value,SORT_NUMERIC);
}
source
share