HH\Map::remove
Removes the specified key (and associated value) from the current Map
public function remove(
Tk $key,
): Map<Tk, Tv>;
This method is interchangeable with removeKey().
Future changes made to the current Map ARE reflected in the returned
Map, and vice-versa.
Parameters
Tk $key
Returns
Map<Tk,Tv>- Returns itself.
Examples
Since Map::remove() returns a shallow copy of $m itself, you can chain a bunch of remove() calls together.
$m = Map {
'red' => '#ff0000',
'green' => '#00ff00',
'blue' => '#0000ff',
'yellow' => '#ffff00',
};
// Remove key 'red'
$m->remove('red');
\var_dump($m);
// Remove keys 'green' and 'blue'
$m->remove('green')->remove('blue');
\var_dump($m);