array_reduce()
function array_reduce(array $array, callable $callback, mixed $initial = null): int
Iteratively reduces an array to a single value using a callback function.
Parameters:
$array(array)$callback(callable)$initial(mixed), defaultnull, optional
Returns: int
Availability
- Compiled (AOT): supported by the Elephc code generator.
eval()(magician interpreter): supported — declarative interpreter builtin (crates/elephc-magician/src/interpreter/builtins/array/array_reduce.rs).
No examples yet — check examples/ and showcases/ for usage patterns.
Internals
For how array_reduce is implemented in the compiler, see the internals page.