Infinite loop?


I don't know why my code is wrong.

The exercise is:

For Loops in PHP

My code:

    <title>Solo For Loop!</title>
        for($i = 10; $i <= 100; $i = $i + 10){
		    echo $i;

The code error:

The program took too long to finish. Check your code for infinite loops and try again.

The exercise example:

for ($i = 0; $i < 101; $i = $i + 10) {
    echo $i;


The code looks fine. It might just be that you were not done typing when the auto-refresh kicked in. Try to refresh the page and submit again.

For the loop exercises, I recommend disabling auto-refresh in one of three ways:

  1. add a temporary error to the code so it throws an error <?php else ?>
  2. zoom up to what ever percentage is necessary to disappear the preview window
  3. reduce window width until the preview disappears


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