PHP代码在线运行


<?php date_default_timezone_set('Asia/Shanghai'); $array = [ [ 'name' => 'super1', 'age' => 12 ], [ 'name' => 'super2', 'age' => 10 ], [ 'name' => 'super3', 'age' => 14 ] ]; foreach ($array as $key => $row) { $distance[$key] = $row['age']; } array_multisort($distance, SORT_DESC, $array); print_r($array);