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 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: http://php.net/manual/en/ds-map.clear.php
Recommended Posts:
- PHP | Imagick clear() Function
- PHP | Ds\Collection clear() Function
- PHP | Ds\Vector clear() Function
- PHP | Gmagick clear() Function
- PHP | Ds\Set clear() Function
- PHP | Ds\Deque clear() Function
- PHP | Ds\Stack clear() Function
- PHP Ds\PriorityQueue clear() Function
- PHP Ds\Queue clear() Function
- PHP | Ds\Pair clear() Function
- PHP | ImagickDraw clear() Function
- How to clear APC cache entries using PHP ?
- How to get the function name inside a function in PHP ?
- PHP 5 vs PHP 7
- PHP | Get PHP configuration information using phpinfo()
- PHP | php.ini File Configuration
- How to import config.php file in a PHP script ?
- PHP | imagecreatetruecolor() Function
- PHP | fpassthru( ) Function
- PHP | ImagickDraw getTextAlignment() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

