该文档似乎没有告诉我们使用什么算法进行数组排序。那么函数 arsort 使用什么算法呢?换句话说,它是使用归并排序还是快速排序?
取自文档的代码:
<?php
$fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple");
arsort($fruits);
foreach ($fruits as $key => $val) {
echo "$key = $val\n";
}
输出:
a = orange
d = lemon
b = banana
c = apple