array_reduce
array_reduce — Iteratively reduce the array to a single value using a callback function.Description
array_reduce( array $array,array_reduce() applies iteratively the callback function to the elements of the array, so as to reduce the array to a single value.
callable $callback,
mixed $initial = null ): mixed
Parameters
array
The input array.
callback
The callback function. callback(mixed $carry, mixed $item): mixed
initial
If the optional initial is available, it will be used at the beginning of the process, or as a final result in case the array is empty.
Return Values
Returns the resulting value.If the array is empty and initial is not passed, array_reduce() returns null.
More information about array_reduce on official PHP documentation site
array_reduce - Popular snippets
- PHP 8.0 / MySQL 5.7 var_export json_decode array_reduce array_values
last run:
2023-03-08 07:24:08
27
- PHP 8.0 / MySQL 5.7 array_reduce print_r array_values
last run:
2023-08-17 13:36:58
25
- PHP 8.0 / MySQL 5.7 str_getcsv array_reduce
last run:
2023-09-27 12:24:41
16
- 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 7.4 / MySQL 5.7 array_reduce array_merge unserialize array_count_values arsort
last run:
2021-10-20 07:49:30
14
- PHP 8.0 / MySQL 5.7 array_reduce array_merge unserialize print_r array_count_values
last run:
2023-05-31 20:58:17
12
- PHP 8.0 / MySQL 5.7 mt_rand strtotime array_reduce date is_null print_r
last run:
2021-11-11 15:08:49
11
- PHP 5.6 / MySQL 5.7 array_reduce array_merge unserialize print_r array_count_values
last run:
2021-10-19 13:38:35
11
- PHP 8.0 / MySQL 5.7 mt_rand strtotime array_reduce date is_null print_r
last run:
2021-11-11 15:09:28
10
- PHP 7.4 / MySQL 5.7 array_reduce is_array array_merge unserialize array_count_values
last run:
2021-10-19 17:22:40
9
array_reduce - New snippets
-
PHP 8.0 / MySQL 5.7 str_getcsv array_reduce var_export
added at:
2023-09-27 12:25:10
2
-
PHP 8.1 / MySQL 5.7 array_reduce
added at:
2023-09-22 11:50:53
1
-
PHP 8.1 / MySQL 5.7 array_reduce
added at:
2023-09-22 11:44:35
1
-
PHP 8.1 / MySQL 5.7 array_reduce
added at:
2023-09-22 11:35:11
1
-
PHP 8.1 / MySQL 5.7 array_reduce
added at:
2023-09-22 11:34:45
1
-
PHP 8.0 / MySQL 8.0 var_export array_reduce extract
added at:
2023-08-30 21:45:03
2
-
PHP 8.0 / MySQL 8.0 var_export array_reduce extract
added at:
2023-08-30 21:44:57
1
-
PHP 8.0 / MySQL 8.0 var_export array_reduce extract
added at:
2023-08-30 21:44:43
1
-
PHP 8.1 / MySQL 5.7 print_r array_reduce
added at:
2023-07-13 11:30:33
1
-
PHP 8.1 / MySQL 5.7 print_r array_reduce
added at:
2023-07-13 11:28:20
1