Sorter
in package
implements
SorterInterface
Class Sorter
Tags
Interfaces, Classes, Traits and Enums
- SorterInterface
- Interface SorterInterface
Table of Contents
- $collator : Collator
- Intl Collator
- $respectLocale : bool
- Do respect current locale?
- __construct() : mixed
- Constructor
- asort() : bool
- Sort array by values and maintain index association
- compare() : int
- Compare function
- natsort() : bool
- Natural sort by values and maintain index association
- sort() : bool
- Sort array by values
- collatorNatsort() : bool
- Function to actually do natural sorting
Properties
$collator
Intl Collator
protected
Collator
$collator
$respectLocale
Do respect current locale?
protected
bool
$respectLocale
Methods
__construct()
Constructor
public
__construct(Collator $collator[, bool $respectLocale = false ]) : mixed
Parameters
- $collator : Collator
-
Current user locale
- $respectLocale : bool = false
-
Do respect current locale?
Return values
mixed —asort()
Sort array by values and maintain index association
public
asort(array<string|int, mixed> &$array) : bool
Parameters
- $array : array<string|int, mixed>
-
Array to sort
Return values
bool —compare()
Compare function
public
compare(string $string1, string $string2) : int
Parameters
- $string1 : string
-
First string to compare
- $string2 : string
-
Second string to compare
Return values
int —natsort()
Natural sort by values and maintain index association
public
natsort(array<string|int, mixed> &$array) : bool
Parameters
- $array : array<string|int, mixed>
-
Array to sort
Return values
bool —sort()
Sort array by values
public
sort(array<string|int, mixed> &$array) : bool
Parameters
- $array : array<string|int, mixed>
-
Array to sort
Return values
bool —collatorNatsort()
Function to actually do natural sorting
protected
collatorNatsort(array<string|int, mixed> &$array) : bool
Parameters
- $array : array<string|int, mixed>
-
Array to sort