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:
2023-10-13 21:58:10
306
- PHP 8.0 / MySQL 5.7 var_export array_map array_reverse func_get_args
last run:
2023-10-04 09:50:32
21
- 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 / MySQL 5.7 array_combine array_values array_map array_keys strtolower print_r
last run:
2022-07-20 14:20:04
12
- PHP 7.4 / MySQL 5.7 array_map explode var_dump
last run:
2023-02-09 19:13:23
11
- PHP 8.1 / MariaDB 10 array_map print_r
last run:
2023-08-20 11:16:42
11
- PHP 8.1 / MySQL 5.7 date time print_r array_map
last run:
2022-07-21 15:25:39
9
array_map - New snippets
-
PHP 5.6 / MySQL 5.7 mt_rand strtotime array_map date array_column max array_keys
added at:
2023-10-31 14:45:00
5
-
PHP 7.4 / MySQL 5.7 ksort array_walk_recursive is_bool implode array_map is_array json_encode array_keys hash
added at:
2023-10-26 14:05:45
1
-
PHP 7.4 / MySQL 5.7 is_array ksort array_walk_recursive is_bool implode array_map json_encode array_keys
added at:
2023-10-26 14:05:10
1
-
PHP 7.4 / MySQL 5.7 is_array ksort array_walk_recursive is_bool implode array_map json_encode array_keys
added at:
2023-10-26 14:05:03
1
-
PHP 8.1 / MySQL 5.7 array_map var_dump
added at:
2023-10-23 17:54:51
1
-
PHP 8.0 / MySQL 5.7 array_map var_dump
added at:
2023-10-10 22:16:12
1
-
PHP 8.0 / MySQL 5.7 array_map var_dump
added at:
2023-10-10 22:15:48
1
-
PHP 8.0 / MySQL 5.7 array_map var_dump
added at:
2023-10-10 22:15:38
1
-
PHP 5.6 / MySQL 5.7 array_map var_dump
added at:
2023-10-10 22:14:11
1
-
PHP 8.0 / MySQL 5.7 array_map var_dump
added at:
2023-10-10 22:14:11
1