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

Returns

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);