Skip to content

Kirby 4.5.0

A::sort()

Sorts a multi-dimensional array by a certain column

A::sort(array $array, string $field, string $direction = 'desc', int $method = 0): array

Parameters

Name Type Default Description
$array * array The source array
$field * string The name of the column
$direction string 'desc' desc (descending) or asc (ascending)
$method int 0 A PHP sort method flag or 'natural' for
natural sorting, which is not supported in
PHP by sort flags

Return type

array

Parent class

Kirby\Toolkit\A