You need to extract all the distances first, then pass both the distance and the data to the function. As shown in example 3 in the array_multisort documentation.
foreach ($data as $key => $row) {
$distance[$key] = $row['distance'];
}
array_multisort($distance, SORT_ASC, $data);
This assumes you want the shortest distances first, otherwise change the SORT_ASC
to SORT_DESC
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…