HH\Map::differenceByKey
Returns a new Map with the keys that are in the current Map, but not
in the provided KeyedTraversable
public function differenceByKey(
KeyedTraversable<Tk, Tv> $traversable,
): Map<Tk, Tv>;
Parameters
KeyedTraversable<Tk,Tv> $traversable- TheKeyedTraversableon which to compare the keys.
Returns
Map<Tk,Tv>- AMapcontaining the keys (and associated values) of the currentMapthat are not in theKeyedTraversable.
Examples
This example shows how differenceByKey can be used to get a new Map with some keys excluded:
$m = Map {
'red' => '#ff0000',
'green' => '#00ff00',
'blue' => '#0000ff',
'yellow' => '#ffff00',
'purple' => '#663399',
};
$m2 = $m->differenceByKey(Set {'red', 'green', 'blue'});
\var_dump($m2);