3. While loops in PHP error


this is my code and they report: infinite loop and can't pass this part.
while($i==2) {echo "ff"; $i = 3;}
I dont understand.
Once I F5 browser, it always displays : $i=2; while($i)
and 1 report: The program took too long to finish. Check your code for infinite loops and try again.
Plz help me.


$i = 2;
while($i == 2) { // should be $i < 3 if you want to print "ff" one time
   echo "ff"; 
   $i++; // or $i += 1;

Look to this example: The PHP while Loop


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.