Code: Select all
while ($i < x){}
It is actually generating output but going into an infinite loop because it doesn't exit correctly when $i is greater than 1.4 with your example. For demonstration purposes, i've modified your code slightly. code blocks are now closed and i added a second exit condition for the second while loop so that it will exit every time, but you can still see that the break is not executed when it should be.
Code: Select all
<?php
$i=0;
$j=5;
while($j==5)
{
echo $i;
echo ",";
$i=$i+.2;
if($i==1)
{
break;
}
}
?>
<?php
$i=0;
$j=5;
while($j==5 && $i <3)
{
echo $i;
echo ",";
$i=$i+0.2;
if($i==2) //even though $i hits 2 it doesn't exit
{
break;
}
}
?>