$input
$input : array
The input array.
List Utility
filter(array $args = array(), string $operator = 'AND') : array
Filters the list, based on a set of key => value arguments.
array | $args | Optional. An array of key => value arguments to match against each object. Default empty array. |
string | $operator | Optional. The logical operation to perform. 'AND' means all elements from the array must match. 'OR' means only one element needs to match. 'NOT' means no elements may match. Default 'AND'. |
Array of found values.
pluck(integer|string $field, integer|string $index_key = null) : array
Plucks a certain field out of each object in the list.
This has the same functionality and prototype of array_column() (PHP 5.5) but also supports objects.
integer|string | $field | Field from the object to place instead of the entire object |
integer|string | $index_key | Optional. Field from the object to use as keys for the new array. Default null. |
Array of found values. If $index_key
is set, an array of found values with keys
corresponding to $index_key
. If $index_key
is null, array keys from the original
$list
will be preserved in the results.
sort(string|array $orderby = array(), string $order = 'ASC', boolean $preserve_keys = false) : array
Sorts the list, based on one or more orderby arguments.
string|array | $orderby | Optional. Either the field name to order by or an array of multiple orderby fields as $orderby => $order. |
string | $order | Optional. Either 'ASC' or 'DESC'. Only used if $orderby is a string. |
boolean | $preserve_keys | Optional. Whether to preserve keys. Default false. |
The sorted array.
sortCallback(object|array $a, object|array $b) : integer
Callback to sort the list by specific fields.
object|array | $a | One object to compare. |
object|array | $b | The other object to compare. |
0 if both objects equal. -1 if second object should come first, 1 otherwise.