• PHP Video Tutorials

PHP - Ds Map union() Function


Advertisements

Ds\Map::union() function can create a new map using values from the current instance and another map.

Syntax

public Ds\Map Ds\Map::union( Ds\Map $map )

Ds\Map::union() function can return a new map containing all pairs of the current instance as well as another map.

Example 1

<?php  
   $map1 = new \Ds\Map(["a" => 1, "b" => 3, "c" => 5]);  
   $map2 = new \Ds\Map(["a" => 2, "c" => 3, "d" => 6]);  
  
   echo("The union of both map: \n");  
   print_r($map1->union($map2)); 
?>

Example 2

<?php  
   $map1 = new \Ds\Map(["a" => "Tutorials", "b" => "Point", "c" => "India"]);  
   $map2 = new \Ds\Map(["b" => "Tuotorix", "d" => "Madhapur", "e" => "Hyderabad"]);  
   
   echo("The union of both map: \n");  
   print_r($map1->union($map2)); 
?>
php_function_reference.htm

Useful Video Courses


Video

PHP Online Training

45 Lectures 9 hours

Malhar Lathkar

Video

Become PHP Facebook Developer: Password-Less Authentication

34 Lectures 4 hours

Syed Raza

Video

Ultimate PHP & MySQL Web Development Course & OOP Coding

84 Lectures 5.5 hours

Frahaan Hussain

Video

Learn PHP from Scratch

17 Lectures 1 hours

Nivedita Jain

Video

E Commerce Website Development In PHP With PDO

100 Lectures 34 hours

Azaz Patel

Video

PHP in Telugu

43 Lectures 5.5 hours

Vijay Kumar Parvatha Reddy

Advertisements