|
Ds\Map::ksortSorts the map in-place by key. Description
public void Ds\Map::ksort
([ callable
$comparator
] )
Sorts the map in-place by key, using an optional Parameters
Return ValuesNo value is returned. ExamplesExample #1 Ds\Map::ksort example
<?php The above example will output something similar to: 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::ksort example using a comparator
<?php 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 ) ) |