Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

array_map()

3 tags 1 category

array_map() — Applies the callback to the elements of the given arrays.

array_map returns an array containing the results of applying the callback to the corresponding value of array (and arrays if more arrays are provided) used as arguments for the callback. The number of parameters that the callback function accepts should match the number of arrays passed to array_map. Excess input arrays are ignored. An ArgumentCountError is thrown if an insufficient number of arguments is provided.

Inputs: callback: A callable to run for each element in each array. null can be passed as a value to callback to perform a zip operation on multiple arrays and return an array where each element is an array containing the elements from the input arrays at the same position of the internal array pointer (see example below). array: An array to run through the callback function. arrays: Supplementary variable list of array arguments to run through the callback function.

Returns: Returns an array containing the results of applying the callback function to the corresponding value of array (and arrays if more arrays are provided) used as arguments for the callback. The returned array will preserve the keys of the array argument if and only if exactly one array is passed. If more than one array is passed, the returned array will have sequential integer keys.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…