PHP 클래스 Sulu\Component\Util\SortUtils

파일 보기 프로젝트 열기: sulu/sulu 1 사용 예제들

공개 메소드들

메소드 설명
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