HH\ImmVector::filterWithKey

Returns an ImmVector containing the values of the current ImmVector that meet a supplied condition applied to its keys and values.

Description

public function filterWithKey(
  (function(int,Tv):bool) $callback,
): ImmVector<Tv>

Returns an ImmVector containing the values of the current ImmVector that meet a supplied condition applied to its keys and values.

Only keys and values that meet a certain criteria are affected by a call to filterWithKey(), while all values are affected by a call to mapWithKey().

Parameters

  • (function(int,Tv):bool) $callback - The callback containing the condition to apply to the current ImmVector keys and values.

Return Values

Examples

See Vector::filterWithKey for usage examples.