Well done!

You have completed Working with Functions!

Quiz Question 1 of 8

What does the following code display?

$numbers = array(1,2,3,4);
$total = count($numbers);
$sum = 0;
$loop = 0;

foreach($numbers as $number) {
    $loop = $loop + 1;
    if ($loop < $total) {
        $sum = $sum + $number;
    }
}

echo $sum;

Choose the correct answer below:

Skip Quiz Review Video