ConstSet::filter

Returns a ConstSet containing the values of the current ConstSet that meet a supplied condition applied to each value.

Description

public function filter(
  callable $fn,
): ConstSet<Tv>

Returns a ConstSet containing the values of the current ConstSet that meet a supplied condition applied to each value.

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

Parameters

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

Return Values