$array = [
['id' => 16863, 'DIST' => 78.4665910403],
['id' => 25676, 'DIST' => 74.2454146892],
['id' => 25687, 'DIST' => 76.4567423542],
];
print_r($array)
Array
(
[0] => Array
(
[id] => 16863
[DIST] => 78.4665910403
)
[1] => Array
(
[id] => 25676
[DIST] => 74.2454146892
)
[2] => Array
(
[id] => 25687
[DIST] => 76.4567423542
)
)
$newArray = $array;
usort($newArray, function ($item1, $item2) {
return $item1['DIST'] == $item2['DIST'] ? 0 : $item1['DIST'] < $item2['DIST'] ? -1 : 1;
});
print_r($newArray)
Array
(
[0] => Array
(
[id] => 25676
[DIST] => 74.2454146892
)
[1] => Array
(
[id] => 25687
[DIST] => 76.4567423542
)
[2] => Array
(
[id] => 16863
[DIST] => 78.4665910403
)
)