reduceRight()
The reduceRight() method all similar to reduce(), but It works in reverse order.
Example.php
Syntax
Parameter
$callback
A function that produces an element of the new Array, taking four arguments:
$accumulator
The accumulator accumulates callback's return values. It is the accumulated value previously returned in the last invocation of the callback—or$initialValue
, if it was supplied (see below).$value
The current element being processed in the array.$key
The index of the current element being processed in the array.$array
The arrayevery
was called upon.
A value to use as the first argument to the first call of the callback.
Return value
The result value.
Prefixing
References
reduce()Last updated