PHP | Ds\Map xor() Function Last Updated : 21 Aug, 2019 Comments Improve Suggest changes 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 PHP | DsSequence map() Function The Ds\Sequence::map() function is an inbuilt function in PHP which returns the result after applying callback function to each value. Syntax: Ds\Sequence abstract public Ds\Sequence::map( $callback ) Parameter: This function accepts single parameter $callback. The callback apply on each value of se 1 min read PHP | array_map() Function The array_map() is an inbuilt function in PHP and it helps to modify all elements one or more arrays according to some user-defined condition in an easy manner. It basically, sends each of the elements of an array to a user-defined function and returns an array with new values as modified by that fu 2 min read PHP | DsDeque sort() Function The Ds\Deque::sort() function is an inbuilt function in PHP which is used to sort the Deque in place by arranging the elements in increasing order. Syntax: public Ds\Deque::sort( $comparator ) : void Parameters::This function accepts single parameter $comparator which holds the function to decides h 2 min read PHP DsMap toArray() Function The Ds\Map::toArray() function in PHP is used to get an array generated by converting the Map instance into an Array. The resulting array is an associative array with elements as in same order as that of the specified Map instance. Syntax: array public Ds\Map::toArray ( void ) Parameter: This functi 1 min read Like