PHP | Ds\Map xor() Function Last Updated : 21 Aug, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The Ds\Map::xor() function is an inbuilt function in PHP which is used to create a new map which contains the value either in the first map or second map but not both. Syntax: Ds\Map public Ds\Map::xor ( Ds\Map $map ) Parameter: This parameter holds the other map of values. Return value: It is used to return a map which contains the xor of the current map with another map. Below programs illustrate the Ds\Map::xor() function in PHP: Program 1: php <?php // Declare a new map $a = new \Ds\Map(["a" => 1, "b" => 3, "c" => 5]); // Declare another new map $b = new \Ds\Map(["a" => 2, "c" => 3, "d" => 6]); // Print the xor of two map echo("xor of both map is: \n"); print_r($a->xor($b)); ?> Output: xor of both map is: Ds\Map Object ( [0] => Ds\Pair Object ( [key] => b [value] => 3 ) [1] => Ds\Pair Object ( [key] => d [value] => 6 ) ) Program 2: php <?php // Declare a new map $a = new \Ds\Map(["a" => "Geeks", "b" => "for", "c" => "Geeks"]); // Declare another new map $b = new \Ds\Map(["b" => "Computer", "e" => "Science", "f" => "Portal"]); // Print the xor of two map echo("xor of both map is: \n"); print_r($a->xor($b)); ?> Output: xor of both map is: Ds\Map Object ( [0] => Ds\Pair Object ( [key] => a [value] => Geeks ) [1] => Ds\Pair Object ( [key] => c [value] => Geeks ) [2] => Ds\Pair Object ( [key] => e [value] => Science ) [3] => Ds\Pair Object ( [key] => f [value] => Portal ) ) Reference: https://www.php.net/manual/en/ds-map.xor.php Comment More infoAdvertise with us Next Article PHP | DsSet xor() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_map Similar Reads PHP | gmp_xor() Function The gmp_xor() is an in-built function in PHP which is used to calculate the XOR of 2 GMP numbers (GNU Multiple Precision : For large numbers). Syntax: gmp_xor( $num1, $num2 ) Parameters: This function accepts two GMP numbers $num1 and $num2 as mandatory parameters shown in the above syntax. These pa 2 min read PHP | DsMap xor() Function The Ds\Map::xor() function is an inbuilt function in PHP which is used to create a new map which contains the value either in the first map or second map but not both. Syntax: Ds\Map public Ds\Map::xor ( Ds\Map $map ) Parameter: This parameter holds the other map of values. Return value: It is used 2 min read PHP | DsSet xor() Function The Ds\Set::xor() function is an inbuilt function in PHP which is used to create a new set which contains the value either in the first set or second set but not both. Syntax: Ds\Set public Ds\Set::xor ( Ds\Set $set ) Parameters: This function accepts a single parameter $set which is used to hold th 2 min read PHP | DsDeque map() Function The Ds\Deque::map() function is an inbuilt function in PHP which is used to return the Deque with each element modified on the basis of operation performed as per the callback function. Syntax: public Ds\Deque::map( $callback ) : Ds\Deque Parameters: This function accepts single parameter $callback 2 min read PHP | DsVector map() Function The Ds\Vector::map() function is an inbuilt function in PHP which is used to return the result of a callback after applying to each value in the vector. Syntax: Ds\Vector public Ds\Vector::map( $callback ) Parameters: This function accepts single parameter $callback which is to be applied to each ve 2 min read PHP | DsMap sort() Function The Ds\Map::sort() function of DS\Map class in PHP is used to in-place sort the elements of a specified Map instance according to the values. By default, the Map is sorted according to the increasing order of the values. Syntax: Ds\Pair public Ds\Map::sort ( int $position ) Parameter: This function 2 min read Like