multisort() public static method
Sorts an array of objects or arrays (with the same structure) by one or several keys.
public static void multisort ( &$array, $key, $direction = SORT_ASC, $sortFlag = SORT_REGULAR ) | ||
---|---|---|
$array | array |
The array to be sorted. The array will be modified after calling this method. |
$key | string|Closure|array |
The key(s) to be sorted by. This refers to a key name of the sub-array elements, a property name of the objects, or an anonymous function returning the values for comparison purpose. The anonymous function signature should be: |
$direction | integer|array |
The sorting direction. It can be either |
$sortFlag | integer|array |
The PHP sort flag. Valid values include |
throws | yii\base\InvalidParamException |
if the $direction or $sortFlag parameters do not have correct number of elements as that of $key. |
Please login to continue.