Mapping
map
Definition
Description
Applies a callback to the elements of given array. Arguments supplied to callback differs depending on selected $mode
.
For backward compatibility using map(callable, array)
is still possible but is deprecated and will issue appropriate warning
Modes
Constant name
Description
MAP_ARRAY_KEY_VALUE
Map array using callback in form of
function($key, $value)
MAP_ARRAY_VALUE_KEYS_LIST
Map array using callback in form of
function($value, $key1, $key2, ...)
MAP_ARRAY_KEYS_ARRAY_VALUE
Map array using callback in form of
function(array $keys, $value)
MAP_ARRAY_VALUE_KEY
Map array using callback in form of
function($value, $key)
Examples
mapObjects
Definition
Description
Map array of object to values returned from objects method
Examples
Last updated