HH\ImmVector::map

Returns an ImmVector containing the results of applying an operation to each value in the current ImmVector.

Description

public function map(
  callable $callback,
): ImmVector<Tu>

Returns an ImmVector containing the results of applying an operation to each value in the current ImmVector.

map()'s result contains a value for every value in the current ImmVector; unlike filter(), where only values that meet a certain criterion are included in the resulting ImmVector.

Parameters

  • callable $callback - The callback containing the operation to apply to the current ImmVector's values.

Return Values

Examples

See Vector::map for usage examples.