A collator class with static methods that can be used for sorting.
More...
|
static | asort (array &$arr, $sortflag=core_collator::SORT_STRING) |
| Locale aware sorting, the key associations are kept, values are sorted alphabetically. More...
|
|
static | asort_array_of_arrays_by_key (array &$array, $key, $sortflag=core_collator::SORT_STRING) |
| Locale aware sort of array of arrays. More...
|
|
static | asort_objects_by_method (array &$objects, $method, $sortflag=core_collator::SORT_STRING) |
| Locale aware sort of objects by a method in common to all objects. More...
|
|
static | asort_objects_by_property (array &$objects, $property, $sortflag=core_collator::SORT_STRING) |
| Locale aware sort of objects by a property in common to all objects. More...
|
|
static | callback_naturalise ($matches) |
|
static | ksort (array &$arr, $sortflag=core_collator::SORT_STRING) |
| Locale aware sorting, the key associations are kept, keys are sorted alphabetically. More...
|
|
|
const | CASE_SENSITIVE = 64 |
| @const do not ignore case when sorting, use bitwise "|" with SORT_NATURAL or SORT_STRING, equivalent to Collator::UPPER_FIRST
|
|
const | SORT_NATURAL = 6 |
| @const compare items like natsort(), equivalent to SORT_NATURAL
|
|
const | SORT_NUMERIC = 2 |
| @const compare items as numbers, equivalent to Collator::SORT_NUMERIC
|
|
const | SORT_REGULAR = 0 |
| @const compare items using general PHP comparison, equivalent to Collator::SORT_REGULAR, this may bot be locale aware!
|
|
const | SORT_STRING = 1 |
| @const compare items as strings, equivalent to Collator::SORT_STRING
|
|
|
static Collator false null | $collator = null |
|
static string null | $locale = null |
| The locale that was used in instantiating the current collator.
|
|
A collator class with static methods that can be used for sorting.
- Copyright
- 2011 Sam Hemelryk 2012 Petr Skoda
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ asort()
Locale aware sorting, the key associations are kept, values are sorted alphabetically.
- Parameters
-
- Return values
-
◆ asort_array_of_arrays_by_key()
Locale aware sort of array of arrays.
Given an array like: $array = array( array('name' => 'bravo'), array('name' => 'charlie'), array('name' => 'alpha') );
If you call: core_collator::asort_array_of_arrays_by_key($array, 'name')
You will be returned $array sorted by the name key of the subarrays. e.g. $array = array( array('name' => 'alpha'), array('name' => 'bravo'), array('name' => 'charlie') );
- Parameters
-
- Return values
-
◆ asort_objects_by_method()
Locale aware sort of objects by a method in common to all objects.
- Parameters
-
- Return values
-
◆ asort_objects_by_property()
Locale aware sort of objects by a property in common to all objects.
- Parameters
-
- Return values
-
◆ ensure_collator_available()
static core_collator::ensure_collator_available |
( |
| ) |
|
|
staticprotected |
Ensures that a collator is available and created.
- Return values
-
bool | Returns true if collation is available and ready |
◆ ksort()
Locale aware sorting, the key associations are kept, keys are sorted alphabetically.
- Parameters
-
- Return values
-
◆ naturalise()
static core_collator::naturalise |
( |
|
$string | ) |
|
|
staticprotected |
Normalise numbers in strings for natural sorting comparisons.
- Parameters
-
- Return values
-
string | string with normalised numbers |
◆ restore_array()
static core_collator::restore_array |
( |
array & |
$arr, |
|
|
array & |
$original |
|
) |
| |
|
staticprotected |
Restore array contents keeping new keys.
- Parameters
-
- Return values
-
The documentation for this class was generated from the following file: