Source Code:
(back to article)
<?php $myArray = [1, 2, 3]; function foo(array $arr) { $sum = array_sum($arr); // calculate the sum of the array echo "The sum of the array is: $sum"; } foo($myArray);
Result:
Report an issue