|
Ds\Set::addAdds values to the set. Description
public void Ds\Set::add
([ mixed
$...values
] )Adds all given values to the set that haven't already been added.
Caution
All comparisons are strict (type and value). Parameters
Return ValuesNo value is returned. ExamplesExample #1 Ds\Set::add example using integers
<?php The above example will output something similar to: object(Ds\Set)#1 (5) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> string(1) "1" [4]=> bool(true) } Example #2 Ds\Set::add example using objects
<?php The above example will output something similar to: object(Ds\Set)#1 (5) { [0]=> object(ArrayIterator)#2 (1) { ["storage":"ArrayIterator":private]=> array(0) { } } [1]=> object(stdClass)#3 (0) { } [2]=> object(stdClass)#4 (0) { } [3]=> object(HashableObject)#5 (1) { ["value":"HashableObject":private]=> int(1) } [4]=> object(HashableObject)#6 (1) { ["value":"HashableObject":private]=> int(2) } } |