|
Ds\Map::ksortedReturns a copy, sorted by key Description
public Ds\Map Ds\Map::ksorted(callable
$comparator = ?)
Returns a copy sorted by key, using an optional Parameters
Return ValuesReturns a copy of the map, sorted by key. ExamplesExample #1 Ds\Map::ksorted example The above example will output something similar to:
Ds\Map Object
Ds\Map Object
(
[0] => Ds\Pair Object
(
[key] => a
[value] => 1
)
[1] => Ds\Pair Object
(
[key] => b
[value] => 2
)
[2] => Ds\Pair Object
(
[key] => c
[value] => 3
)
)
Example #2 Ds\Map::ksorted example using a comparator The above example will output something similar to:
Ds\Map Object
Ds\Map Object
(
[0] => Ds\Pair Object
(
[key] => 2
[value] => y
)
[1] => Ds\Pair Object
(
[key] => 1
[value] => x
)
[2] => Ds\Pair Object
(
[key] => 0
[value] => z
)
)
|