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-11-14 23:57:08
24
- 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-07-17 15:01:39
14
- 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 7.4 / MySQL 5.7 print_r array_map
added at:
2024-11-19 19:30:48
1
-
PHP 7.4 / MySQL 5.7 print_r array_map
added at:
2024-11-19 19:28:49
1
-
PHP 7.4 / MySQL 5.7 print_r array_map
added at:
2024-11-19 19:28:40
1
-
PHP 7.4 / MySQL 5.7 var_export array_map array_reverse func_get_args
added at:
2024-11-19 18:51:15
1
-
PHP 8.0 / MySQL 5.7 var_export array_map array_reverse func_get_args str_split
added at:
2024-11-19 18:50:32
1
-
PHP 8.0 / MySQL 5.7 var_export array_map array_reverse func_get_args
added at:
2024-11-19 18:49:24
2
-
PHP 8.0 / MySQL 5.7 var_export array_map array_reverse func_get_args
added at:
2024-11-19 18:49:17
1
-
PHP 8.0 / MySQL 5.7 var_export array_map array_reverse func_get_args
added at:
2024-11-19 18:49:05
1
-
PHP 8.1 / MySQL 5.7 implode array_map array_keys
added at:
2024-11-12 03:52:44
1
-
PHP 8.1 / MySQL 5.7 array_keys implode array_map array_filter print_r
added at:
2024-11-12 03:42:21
1