HH\Map::clear
Remove all the elements from the current Map
public function clear(): Map<Tk, Tv>;
Future changes made to the current Map
ARE reflected in the returned
Map
, and vice-versa.
Returns
Map<Tk, Tv>
- Returns itself.
Examples
$m = Map {
'red' => '#ff0000',
'green' => '#00ff00',
'blue' => '#0000ff',
'yellow' => '#ffff00',
};
var_dump($m);
$m->clear();
var_dump($m);
object(HH\Map)#1 (4) {
["red"]=>
string(7) "#ff0000"
["green"]=>
string(7) "#00ff00"
["blue"]=>
string(7) "#0000ff"
["yellow"]=>
string(7) "#ffff00"
}
object(HH\Map)#1 (0) {
}