PHP Класс Sulu\Component\Util\SortUtils

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
multisort ( array $values, $paths, string $direction = 'ASC' ) : array Sort the given array of arrays/objects using paths.

Приватные методы

Метод Описание
__construct ( ) Cannot instantiate this class.

Описание методов

multisort() публичный статический Метод

e.g. $data = array( array('foobar' => 'b'), array('foobar' => 'a'), ); SortUtils::multisort($data, '[foobar]', 'asc'); echo $data[0]; // "a" You can also use method names: SortUtils::multisort($data, 'getFoobar', 'asc'); Or sort on multidimensional arrays: SortUtils::multisort($data, 'foobar.bar.getFoobar', 'asc'); And you can sort on multiple paths: SortUtils::multisort($data, array('foo', 'bar'), 'asc'); The path is any path accepted by the property access component:
public static multisort ( array $values, $paths, string $direction = 'ASC' ) : array
$values array
$direction string Direction to sort in (either ASC or DESC)
Результат array