-
-
Notifications
You must be signed in to change notification settings - Fork 13
IEnumerable.orderDescending() method
Marcel Kloubert edited this page Apr 3, 2021
·
3 revisions
Sorts the sequence in decending order by using the elements as sort values.
public IEnumerable orderDescending([callable $algo]);
Name | Type | Description |
---|---|---|
$algo | callable | [OPTIONAL] The custom sort algorithm. |
The ordered sequence.
$seq = Enumerable::values(2, 3, 1);
// [3, 2, 1]
$a = $seq->orderDescending()
->toArray();
$seq = Enumerable::values('2', '3', '1');
// ['1', '2', '3']
$a = $seq->orderDescending(function($x, $y) { return strcmp($x, $y) * -1; })
->toArray();