Source Code:
(back to article)
<?php $array = array(1, 2, 3, 4, 5); $total = 0; array_walk($array, function($value, $key) use (&$total) { $total += $value; }); echo "The total sum is: $total"; ?>
Result:
Report an issue