• PHP Video Tutorials

PHP - Ds Map diff() Function


Advertisements

Ds\Map::diff() function can create a new map by using keys that aren't in another map.

Syntax

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

Ds\Map:: diff() function can return the result of removing all keys from the current instance that are present in a given map.

Example 1

<?php  
   $map1 = new \Ds\Map(["1" => "10", "2" => 20, "3" => 30]);               
   $map2 = new \Ds\Map(["3" => "30", "4" => 40, "5" => 50]);
  
   echo "The difference between two maps: <br>";
   print_r($map1 -> diff($map2)); 
?>

Example 2

<?php  
   $map1 = new \Ds\Map(["1" => "Tutorials", "2" => "Point", "3" => "India"]);          
   $map2 = new \Ds\Map([ 2" => "Point", "3" => "Tutorials", "4" => "Tutorix"]); 
  
   echo "The difference between two maps: <br>"; 
   print_r($map1 -> diff($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