Skip to content

Kirby 4.4.1

A::map()

A simple wrapper around array_map with a sane argument order

A::map(array $array, callable $map): array

Parameters

Name Type Default
$array * array
$map * callable

Return type

array

Parent class

Kirby\Toolkit\A

Example

// why this weird, inconsistent argument order?
$array = array_map(function ($item) {
  // some mapping
}, $array);

// yes!
$array = A::map($array, function ($item) {
  // some mapping
});