HH\ImmVector::filter

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

public function filter(
  (function(Tv): bool) $callback,
): ImmVector<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 ImmVector.

Guide

Parameters

  • (function(Tv): bool) $callback

Returns

Examples

See [Vector::filter](</hack/reference/class/Vector/filter/#examples>) for usage examples.