HH\ImmVector::filter

Returns a ImmVector containing the values of the current ImmVector that meet a supplied condition.

Description

public function filter(
  callable $callback,
): ImmVector<Tv>

Returns a ImmVector containing the values of the current ImmVector that meet a supplied condition.

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

Parameters

  • callable $callback - The callback containing the condition to apply to the current ImmVector values.

Return Values

Examples

See Vector::filter for usage examples.