PHP | DS\Map clear() Function Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The DS\Map::clear() function of the Map class in PHP is used to clear a Map object. That is it deletes all of the values from a given Map object. It does not delete the Map, it just removes all of the values from the Map object. Syntax: void public Ds\Map::clear ( void ) Parameter: It does not accepts any parameter. Return value: This function does not returns any value. Below program illustrate the DS\Map::clear() function in PHP: php <?php // PHP program to illustrate the clear() // function of Ds\map // Creating a Map $map = new \Ds\Map(["1" => "Geeks", "2" => "for", "3" => "Geeks"]); // Removing all values from Map $map->clear(); print_r($map); ?> Output: Ds\Map Object ( ) Reference: https://www.php.net/manual/en/ds-map.clear.php Comment More infoAdvertise with us Next Article PHP | DsPair clear() Function G gopaldave Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_map Similar Reads PHP | Ds\Set clear() Function The Ds\Set::clear() function is an inbuilt function in PHP which is used to remove all values from the set. Syntax: void public Ds\Set::clear( void ) Parameters: This function does not accept any parameter. Return value: This function does not return any value. Below programs illustrate the Ds\Set:: 1 min read PHP | Ds\Set clear() Function The Ds\Set::clear() function is an inbuilt function in PHP which is used to remove all values from the set. Syntax: void public Ds\Set::clear( void ) Parameters: This function does not accept any parameter. Return value: This function does not return any value. Below programs illustrate the Ds\Set:: 1 min read PHP | DsPair clear() Function The Ds\Pair::clear() function is an inbuilt function in PHP which is used to remove all values from the pair. Syntax: void Ds\Pair::clear( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustrate the Ds\Pair::cl 1 min read PHP | Ds\Deque 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 | Ds\Deque 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 | Ds\Deque clear() Function The Ds\Deque::clear() function is an inbuilt function in PHP which is used to clear the Deque by removing all elements from the Deque. Syntax: public Ds\Deque::clear( void ) : void Parameters: This function does not accepts any parameter. Return Value: This function does not return any Value. Below 2 min read Like