• PHP Video Tutorials

PHP - Ds Set merge() Function



Ds\Set::merge() function can return the result of adding all given values to a set.

Syntax

public Ds\Set Ds\Set::merge( mixed $values )

Ds\Set::merge() function can return the result of adding all given values to a set, effectively the same as adding values to a copy and then return that copy.

Example 1

<?php  
   $set = new \Ds\Set([5, 10, 15, 20]);  
   var_dump($set->merge([1, 2, 3]));  
   var_dump($set)  
?>  

Example-2

<?php  
   $set = new \Ds\Set([5, 10, 15, 20]);  
   var_dump($set->merge(["I", "N", "D", "I", "A"]));  
?>  
php_function_reference.htm
Advertisements