array_map
Applies a callback function to the elements of one or more arrays and returns a new array with the results.
Parameters
main.php
Return Values
array
Returns an array containing the results of applying callback to each element
On success:New array with transformed elements from the callback function
On failure:Empty array if input arrays are empty
Notes
- Does not modify the original arrays - returns a new array
- If callback is null, performs a zip operation on multiple arrays
- Number of callback parameters must match number of arrays provided
- Preserves keys only when exactly one array is passed
Changelog
- 8.0.0: callback is now nullable
Related Functions
array_filter
ArrayFilters elements of an array using a callback function, returning only elements that pass the test.
filtercallbackarray