PHP | Ds\Set xor() Function Last Updated : 22 Aug, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 the set of values. Return Value: It is used to return a set which contains the xor of the current set with another set. Below programs illustrate the Ds\Set::xor() function in PHP: Program 1: php <?php // Declare a new set $a = new \Ds\Set([1, 3, 5]); // Declare a new set $b = new \Ds\Set([2, 3, 6]); // Print the xor of both set echo("xor of both set is: \n"); print_r($a->xor($b)); ?> Output: xor of both set is: Ds\Set Object ( [0] => 1 [1] => 5 [2] => 2 [3] => 6 ) Program 2: php <?php // Declare a new set $a = new \Ds\Set([2, 3, 6, 7, 8]); // Declare a new set $b = new \Ds\Set([2, 3, 5, 8, 9, 10]); // Print the xor of both set echo("xor of both set is: \n"); var_dump($a->xor($b)); ?> Output: xor of both set is: object(Ds\Set)#3 (5) { [0]=> int(6) [1]=> int(7) [2]=> int(5) [3]=> int(9) [4]=> int(10) } Reference: https://www.php.net/manual/en/ds-set.xor.php Comment More infoAdvertise with us Next Article PHP | DsMap xor() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_set Similar Reads 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 | 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 | DsDeque set() Function The Ds\Deque::set() function is an inbuilt function in PHP which is used to set the value at the given index in the Deque. Syntax: public Ds\Deque::set( $index, $value ) : void Parameters: This function accept two parameters as mentioned above and described below: index: This parameter holds the ind 2 min read PHP | DsVector set() Function The Ds\Vector::set() function is an inbuilt function in PHP which is used to set the value in the vector at the given index. Syntax: void public Ds\Vector::set( $index, $value ) Parameters: This function accepts two parameters as mentioned above and described below: $index: This parameter holds the 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 PHP | DsSequence set() Function The Ds\Sequence::set() function is an inbuilt function in PHP which is used to updates a value at a given index. Syntax: void abstract public Ds\Sequence::set ( int $index , mixed $value ) Parameters: This function accepts two parameters as mentioned above and described below: $index: It is used to 2 min read Like