The doc doesnt seem to tell us what algorithm is used for array sorting. So what algorithm does the function arsort use? In otherwords, does it use merge sort, quick sort?
Code taken from doc:
<?php
$fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple");
arsort($fruits);
foreach ($fruits as $key => $val) {
echo "$key = $val\n";
}
Output:
a = orange
d = lemon
b = banana
c = apple
Like all PHP sort functions, the quicksort algorithm is used
See the Note in the manual:
Note: Like most PHP sorting functions, sort() uses an implementation of » Quicksort.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With