A::map()
A simple wrapper around array_map with a sane argument order
A::map(array $array, callable $map): array
Parameters
| Name | Type | Default |
|---|---|---|
| $arrayrequired | array |
no default value |
| $maprequired | callable |
no default value |
Return type
array
Parent class
Examples
// why this weird, inconsistent argument order?
$array = array_map(function ($item) {
// some mapping
}, $array);
// yes!
$array = A::map($array, function ($item) {
// some mapping
});