For循环在PHP中的负值不起作用

This loop showing empty page i want to run it til -60.

for($i = 6; $i <= -60; $i-=6){         
    echo $i;   echo '</br>';
}

Use >=, not <=:

for($i = 6; $i >= -60; $i-=6){

   echo $i;   echo '</br>';

}

Note that >= is greater than or equal, and <= is less than or equal.

Your requirement and code are contradictory. Starting from $i = 6 and then check if $i is less than or equal to -60 which is false. Rewrite your code like this.

for($i = 6; $i >= -60; $i-=6){         
    echo $i;   echo '</br>';
}

Output as expected:

6
0
-6
-12
-18
-24
-30
-36
-42
-48
-54
-60

People are usually hard on newbies, but we've gotta be patient, we were all newbies once. And I think OP is in need of something more than just answer to his [trivial] question.

Good stuff that could have been done before asking the question

  1. You should have gone through a basic PHP course (like learn-php.org or Codecademy)
  2. You should have tried a similar chapter of a different course if the question arose during such a course
  3. You should have read the StackOverflow guidelines towards asking a question
  4. You should have read about PHP for loop and PHP comparison operators
  5. You could have read about PHP syntax quidelines so that you wouldn't have two echo statements on the same line (and absence of spaces where they are needed).

    2.3. Lines

    There MUST NOT be more than one statement per line.