Who can help explain the mechanism of the function array_reduce http://php.net/array_reduce
I have a description that is in the docks "array_reduce () iteratively applies the callback function of the callback to the elements of the array array and, thus, reduces the array to a single value." don't understand at all.
What does it mean "driving" are other values discarded? The principle of information is also not clear, which one leaves the largest, the smallest and why?
For example, in the code below:
$array = array( 1, 2, 'tom', '7jerry', 010, '020' ); $callback = function ($a, $b) { return $a + intval($b); }; echo array_reduce($array, $callback, 1); The answer will be 39, but why and how it turns out is not clear.