__construct()
__construct(array|\Traversable $items, callable|string $callback, integer $dir = \SORT_DESC, integer $type = \SORT_NUMERIC)
Wraps this iterator around the passed items so when iterated they are returned in order.
The callback will receive as first argument each of the elements in $items, the value returned in the callback will be used as the value for sorting such element. Please note that the callback function could be called more than once per element.
Parameters
array|\Traversable | $items | The values to sort |
callable|string | $callback | A function used to return the actual value to be compared. It can also be a string representing the path to use to fetch a column or property in each element |
integer | $dir | either SORT_DESC or SORT_ASC |
integer | $type | the type of comparison to perform, either SORT_STRING SORT_NUMERIC or SORT_NATURAL |