HH\Vector::filter

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

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

filter()'s result contains only values that meet the provided criterion; unlike map(), where a value is included for each value in the original Vector.

Parameters

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

Return Values

  • Vector<Tv> - A Vector containing the values after a user-specified condition is applied.