init fun 默认 null int car ret return
1. 函数的作用:用函数迭代数组的所有元素
2. 函数的参数:
[email protected] array $array 用于迭代的数组
[email protected] callable $callback 迭代的函数
[email protected] mixed $initial 迭代的初始值 ,默认为 NULL
3. 例子:
- <?php
- $arr = ['a','b','c','d','e'];
- print_r(array_reduce($arr,function($carry,$item){
- return $carry.$item;
- },null));
PHP array_reduce
来源: http://www.bubuko.com/infodetail-2068447.html