|
Ds\Map::putAssociates a key with a value 説明
public void Ds\Map::put(mixed
$key, mixed $value)
Associates a
警告
Be careful when using array syntax. Scalar keys will be coerced to
integers by the engine. For example, See Arrays. パラメータ
戻り値値を返しません。 例例1 Ds\Map::put 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::put example using objects as keys 上の例の出力は、 たとえば以下のようになります。
object(Ds\Map)#1 (5) {
[0]=>
object(Ds\Pair)#7 (2) {
["key"]=>
object(ArrayIterator)#2 (1) {
["storage":"ArrayIterator":private]=>
array(0) {
}
}
["value"]=>
int(2)
}
[1]=>
object(Ds\Pair)#8 (2) {
["key"]=>
object(stdClass)#3 (0) {
}
["value"]=>
int(3)
}
[2]=>
object(Ds\Pair)#9 (2) {
["key"]=>
object(stdClass)#4 (0) {
}
["value"]=>
int(4)
}
[3]=>
object(Ds\Pair)#10 (2) {
["key"]=>
object(HashableObject)#5 (1) {
["value":"HashableObject":private]=>
int(1)
}
["value"]=>
int(6)
}
[4]=>
object(Ds\Pair)#11 (2) {
["key"]=>
object(HashableObject)#6 (1) {
["value":"HashableObject":private]=>
int(2)
}
["value"]=>
int(8)
}
}
|