Sort
in package
Class Sort
Table of Contents
Methods
- sort() : array<string|int, mixed>
- getSortValue() : int
Methods
sort()
public
static sort(array<string|int, mixed> &$arr[, string $field = 'sortOrder' ][, int $default = PHP_INT_MAX ]) : array<string|int, mixed>
Parameters
- $arr : array<string|int, mixed>
-
The input array.
- $field : string = 'sortOrder'
-
The attribute or array key to which holds the sort order
- $default : int = PHP_INT_MAX
-
The default sort order if field value is empty. Default PHP_INT_MAX
Return values
array<string|int, mixed> —the sorted array
getSortValue()
private
static getSortValue(array<string|int, mixed>|object $obj, string $field, int $default) : int
Parameters
- $obj : array<string|int, mixed>|object
-
the object or array
- $field : string
-
the field name
- $default : int
-
the default sort order