3/6 While Loops in PHP - What is wrong with my code? :(


#1
<?php
$loopCount = 2;
while ($loopCount < 9){
    echo "<p>Iteration number: {$loopCount}</p>";
    $loopCount + 2;
    }
?>

I want the while loop to count all the even numbers until 8. What is wrong with my code?


#2
<?php
$loopCount = 2;
while ($loopCount < 9){
    echo "<p>Iteration number: {$loopCount}</p>";
    $loopCount + 2; // 
    }
?>

You have a infinite loop!
This should help

$loopCount = $loopCount +2;

#3

Thank you! :innocent: