HH\Map::filter

Returns a Map containing the values of the current Map that meet a supplied condition

public function filter(
  (function(Tv):bool) $callback,
): Map<Tk, Tv>;

Only values that meet a certain criteria are affected by a call to filter(), while all values are affected by a call to map().

The keys associated with the current Map remain unchanged in the returned Map.

Parameters

  • (function(Tv):bool) $callback - The callback containing the condition to apply to the current Map values.

Return Values

  • Map<Tk, Tv> - a Map containing the values after a user-specified condition is applied.