排序数字列表
$array = [1, 0, 5, 9, 3, 7, 6, 8, 4, 2];
usort($array, function (int $a, int $b): int {
return $a <=> $b;
});
print_r($array);
Array
(
[0] => 0
[1] => 1
[2] => 2
[3] => 3
[4] => 4
[5] => 5
[6] => 6
[7] => 7
[8] => 8
[9] => 9
)