Why I just a PHP script?

Hello! Doing a simple task in PHP , but I don't understand why it hangs. Or I've studied and do not see any details, tell me )

<p>Print the sum of even numbers from 10 to 40</p>

$summ = 0;
$num = 10;

while($num <= 40){

 if(($num%2) != 0) continue;
 $summ += $num;

echo $summ;

June 6th 19 at 11:57
1 answer
June 6th 19 at 11:59
continue is used inside cyclic structures to skip the rest of current iteration of the loop and under the conditions, the start of the next iteration.

11 is always less than 40, so the loop will be infinite

Find more questions by tags PHP