PDA

View Full Version : understanding the while loop


tony09uk
01-27-2012, 09:33 PM
Hi, im just trying to get a stronger understanding of while loop. I made a very simple script:


$a = 97;
$b = 23;

while ($a <= 1000) {
echo $a + $b;
echo "<br/>";
$a = $a + $b;
}

It behaves as expected until the final output figure which is 1017. Why? I have set it to be equal or less than 1000, can someone please tell me why the script is passing 1000?