What is the issue with the PHP script that is causing the output to always be "0"?

The issue with the PHP script is that the variable $sum is being reinitialized to 0 on each iteration of the loop, causing it to always output "0". To solve this issue, we need to move the initialization of $sum outside of the loop so that it accumulates the values correctly.

<?php
$numbers = [1, 2, 3, 4, 5];
$sum = 0;

foreach($numbers as $number){
    $sum += $number;
}

echo $sum;
?>