PHP | Ds\Map intersect() Function Last Updated : 20 Mar, 2023 Comments Improve Suggest changes Like Article Like Report The Ds\Map::intersect() function is an inbuilt function in PHP, which is used to create a new map which contains the intersection with another map. Syntax: public Ds\Map::intersect( Ds\Map $map ) Parameter: This function accepts single parameter $map which holds the other map which contains the key of other elements. Return value: This function returns the intersection of current map with other map. Below programs illustrate the Ds\Map::intersect() function in PHP: Program 1: php <?php // PHP program to illustrate the intersect() // function of Ds\map // Creating a Map $map1 = new \Ds\Map(["1" => "10", "3" => 30, "4" => 40]); // Creating another Map $map2 = new \Ds\Map(["2" => "20", "3" => 35, "5" => 50, "6" => 60]); // Use Ds\Map::intersect() function print_r($map1 -> intersect($map2)); ?> Output:Ds\Map Object ( [0] => Ds\Pair Object ( [key] => 3 [value] => 30 ) ) Program 2: php <?php // PHP program to illustrate the intersect() // function of Ds\map // Creating a Map $map1 = new \Ds\Map([ "1" => "Geeks", "2" => "for", "3" => "Geeks"]); // Creating another Map $map2 = new \Ds\Map([ "2" => "for", "3" => "Geeks", "4" => "GeeksforGeeks"]); // Use Ds\Map::intersect() function print_r($map1 -> intersect($map2)); ?> Output:Ds\Map Object ( [0] => Ds\Pair Object ( [key] => 2 [value] => for ) [1] => Ds\Pair Object ( [key] => 3 [value] => Geeks ) ) Reference: https://www.php.net/manual/en/ds-map.intersect.php Comment More infoAdvertise with us Next Article PHP | DsSet intersect() Function jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_map Similar Reads PHP | DsMap intersect() Function The Ds\Map::intersect() function is an inbuilt function in PHP, which is used to create a new map which contains the intersection with another map. Syntax: public Ds\Map::intersect( Ds\Map $map ) Parameter: This function accepts single parameter $map which holds the other map which contains the key 2 min read PHP | DsSet intersect() Function The Ds\Set::intersect() function is an inbuilt function in PHP which is used to create a new set which contains the intersection of two sets. Syntax: Ds\Set public Ds\Set::intersect ( Ds\Set $set ) Parameters: This parameter holds the set which contains set elements. Return Value: This function retu 1 min read PHP array_intersect() Function This builtin function of PHP is used to compute the intersection of two or more arrays. The function is used to compare the values of two or more arrays and returns the matches. The function prints only those elements of the first array that are present in all other arrays. Syntax: array array_inter 2 min read PHP array_intersect_key() Function This builtin function of PHP is used to compute the intersection of two or more arrays. The function is different from array_intersect() and array_intersect_assoc() in a way that it uses the keys for the comparison and returns the matching key elements. The function prints only those elements of the 2 min read PHP array_intersect_assoc() Function The array_intersect_assoc() is a builtin function in PHP and is used to compute the intersection of two or more arrays. This function is similar to the function array_intersect() which is discussed in the article PHP | array_intersect() function. The function is also used to compare the values of tw 3 min read PHP | DsDeque insert() Function The Ds\Deque::insert() function is an inbuilt function in PHP which is used to insert the value at the given index in the Deque. Syntax: public Ds\Deque::insert( $index, $values ) : void Parameters: This function accepts two parameter as mentioned above and described below: $index: This parameter ho 2 min read PHP | array_intersect_ukey() Function The array_intersect_ukey() function is an inbuilt function in PHP which is used to compute the intersection of two or more array against keys with the help of user-defined function and the function return an array. The returned array is the first array, which is matching keys and present in all para 5 min read PHP | DsVector insert() Function The Ds\Vector::insert() function is an inbuilt function in PHP which is used to insert the element into the vector at the given index. Syntax: void public Ds\Vector::insert( $index, $values ) Parameters: This function accepts two parameter as mentioned above and described below: $index: This paramet 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 array_intersect_uassoc() Function The array_intersect_uassoc() function is an inbuilt function in PHP. It is used to compare key and values of two or more arrays by using a user-defined comparison function and return the matches.The comparison function returns an integer equal to, greater than, or less than zero. If the first argume 6 min read Like