Creates a Closure that sorts an array or iterable by value in descending order, preserving key-value associations.
/**
* @param int $flag PHP sort flag constant.
* @return Closure(iterable<int|string, mixed>):mixed[]
*/
Arrays\arsort(int $flag = SORT_REGULAR): ClosureWhen Arrays\arsort() is called, it returns the following Closure which can be used like a regular function.
/**
* @param iterable<int|string, mixed> $source
* @return mixed[]
*/
$function (iterable $source): arrayThis can be used to create a simple closure which can be used as a regular function.
$byValueDesc = Arrays\arsort();
print_r($byValueDesc(['a' => 1, 'b' => 3, 'c' => 2]));
// ['b' => 3, 'c' => 2, 'a' => 1]