HH\Map::map

Returns a Map after an operation has been applied to each value in the current Map

public function map<Tu>(
  (function(Tv):Tu) $callback,
): Map<Tk, Tu>;

Every value in the current Map is affected by a call to map(), unlike filter() where only values that meet a certain criteria are affected.

The keys will remain unchanged from the current Map to the returned Map.

Parameters

  • (function(Tv):Tu) $callback - The callback containing the operation to apply to the current Map values.

Return Values

  • Map<Tk, Tu> - a Map containing key/value pairs after a user-specified operation is applied.