PHP » GoLang |
login |
register |
about
|
|
Ds\Set::add(PECL ds >= 1.0.0) Ds\Set::add — Adds values to the set DescriptionAdds 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
<?phpThe 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
<?phpThe 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)
}
}
|
more
Most requested
more
Last requests
|