array_map
array_map — Applies the callback to the elements of the given arrays.Description
array_map( ?callable $callback,array_map() returns an array containing the results of applying the callback to the corresponding index 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.
array $array,
array ...$arrays ): array
Parameters
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. If only array is provided, array_map() will return the input array.
null can be passed as a value to callback to perform a zip operation on multiple arrays. If only array is provided, array_map() will return the input array.
array
An array to run through the callback function.
arrays
Supplementary variable list of array arguments to run through the callback function.
Return Values
Returns an array containing the results of applying the callback function to the corresponding index 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.
More information about array_map on official PHP documentation site
array_map - Popular snippets
- PHP 8.0 / MySQL 5.7 var_dump array_map
last run:
2024-04-06 08:45:16
308
- PHP 8.1 / MySQL 5.7 array_filter array_map array_values print_r
last run:
2024-12-13 14:17:06
27
- PHP 8.0 / MySQL 5.7 var_export array_map array_reverse func_get_args
last run:
2024-05-05 12:41:00
23
- PHP 8.2.13 / MySQL 8.0 Sakila (ReadOnly) array_map var_export
last run:
2024-01-08 10:17:42
18
- PHP 8.0 / MySQL 5.7 mt_rand strtotime array_map date array_column max array_keys
last run:
2023-10-31 14:44:52
18
- PHP 8.1 / MySQL 5.7 array_map count min max array_values array_reduce print_r
last run:
2022-10-19 12:12:55
16
- PHP 8.0 / MySQL 5.7 implode array_filter preg_match array_map strlen range
last run:
2021-05-02 20:42:52
16
- PHP 7.4 / MySQL 5.7 var_dump array_map
last run:
2021-07-08 14:53:08
16
- PHP 8.1 / MariaDB 10 array_map print_r
last run:
2024-12-16 10:46:56
15
- PHP 8.1 / MySQL 5.7 array_combine array_values array_map array_keys strtolower print_r
last run:
2022-07-20 14:20:04
12
array_map - New snippets
-
PHP 8.1 / MySQL 5.7 array_map var_dump implode
added at:
2024-12-13 03:16:03
1
-
PHP 8.1 / MySQL 5.7 var_dump array_map implode
added at:
2024-12-12 08:54:29
1
-
PHP 8.1 / MySQL 5.7 var_dump array_map implode
added at:
2024-12-12 08:53:46
1
-
PHP 8.1 / MySQL 5.7 var_dump array_map implode
added at:
2024-12-12 08:52:19
1
-
PHP 8.1 / MySQL 5.7 var_dump range array_map implode
added at:
2024-12-12 08:37:42
1
-
PHP 8.1 / MySQL 5.7 var_dump range array_map implode
added at:
2024-12-12 08:37:18
2
-
PHP 8.0 / MySQL 8.0 json_encode array_map strtotime
added at:
2024-12-03 04:44:43
1
-
PHP 8.0 / MySQL 8.0 json_encode array_map strtotime
added at:
2024-12-03 04:44:32
1
-
PHP 8.1 / MySQL 5.7 array_filter array_map array_values print_r
added at:
2024-11-29 10:08:25
3
-
PHP 8.1 / MySQL 5.7 array_filter array_map array_values print_r
added at:
2024-11-29 10:08:20
1