|
Ds\Map::ksortSorts the map in-place by key 説明
public void Ds\Map::ksort(callable
$comparator = ?)
Sorts the map in-place by key, using an optional パラメータ
戻り値値を返しません。 例例1 Ds\Map::ksort example 上の例の出力は、 たとえば以下のようになります。
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
)
)
例2 Ds\Map::ksort example using a comparator 上の例の出力は、 たとえば以下のようになります。
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
)
)
|