+

PHP Ds / Map xor () function

Syntax:
DsMap public DsMap::xor (DsMap $map)
Parameter: this parameter contains another value map.Return value:used to return a map that contains the xor of the current map with a different map.Below the program illustrate the Ds / Map::xor()function in PHP:Program 1:  
// Declare a new map $a = new DsMap ([ "a" = > 1, "b" = > 3, "c" = > five]);  
// Declare another new map $b = new DsMap ([ " a " = > 2, " c " = > 3, " d " = > 6 ]);  
// Print xor of two cards echo ( "xor of both map is:" ); print_r ( $a -> xor ( $b ));  
?>
Exit:
xor of both map is: DsMap Object ([0] = > DsPair Object ([key] = > b [value] = > 3) [1] = > DsPair Object ([key] = > d [value] = > 6))
Program 2:  
// Declare a new map $a = new DsMap ([ "a" = > "Geeks" , "b" = > "for" , "c" = > "Geeks" ]);  
// Declare another new map $b = new DsMap ([ " b " = > " Computer " , "e" = > "Science" , " f " = > " Portal " ]) ;  
// Print xor of two cards echo ( "xor of both map is:" ); print_r ( $a -> xor ( $b ));  
?>
Exit:
xor of both map is: DsMap Object ([0] = > DsPair Object ([key] = > a [value] = > Geeks) [1] = > DsPair Object ([key] = > c [value] = > Geeks) [2] = > DsPair Object ([key] = > e [value] = > Science) [3] = > DsPair Object ([key] = > f [value] = > Portal))
Link: https:// www .php.net / manual / en / ds-map.xor.php
Get Solution for free from DataCamp guru