• PHP Video Tutorials

PHP - Ds Vector merge() Function



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

Syntax

abstract public Ds\Sequence Ds\Sequence::merge( mixed $values )

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

Example 1

<?php 
   $array1 = new \Ds\Vector([10, 20, 30, 40, 50]); 
  
   echo("The original vector elements: \n"); 
   print_r($array1); 
  
   $array2 = new \Ds\Vector([60, 70, 80, 90, 100]); 
   echo("The vector elements after merge() function: \n"); 
   print_r($array1->merge($array2)); 
?>

Example-2

<?php 
   $array1 = new \Ds\Vector(["Tutorials", "Point", "Tutorix"]); 
   echo("The original vector elements: \n"); 
   print_r($arr1); 
  
   $array2 = new \Ds\Vector(["Hyderabad", "Madhapur", "India"]); 
   echo("The vector elements after merge() function: \n"); 
   print_r($array1->merge($array2));  
?>
php_function_reference.htm
Advertisements