• PHP Video Tutorials

PHP - Ds Map intersect() Function


Advertisements

Ds\Map::intersect() function can create a new map by intersecting keys with another map.

Syntax

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

Ds\Map::intersect() function can create a new map containing the pairs of current instance whose keys are present in a given map. In other words, returning a copy of the current instance with all keys removed that are not on the other map.

Ds\Map::intersect() function can return a key intersection of the current instance and another map.

Example 1

<?php  
   $mapOne = new \Ds\Map(["1" => "10", "2" => 20, "4" => 40]);  
   $mapTwo = new \Ds\Map(["2" => "20", "4" => 40, "5" => 50]);  
  
   print_r($mapOne -> intersect($mapTwo)); 
?>  

Example 2

<?php  
   $mapOne = new \Ds\Map(["1" => "Tutorials", "2" => "Point", "3" => "India"]); 
   $mapTwo = new \Ds\Map(["2" => "Point", "3" => "India", "4" => "Tutorix"]); 
  
   print_r($mapOne -> intersect($mapTwo)); 
?>  
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