for ($i = 1; $i <= 10; $i+=4 { 
    echo $i; 

解决方案 »

  1.   

    错了,不过加半拉括号就对了:
    for ($i = 1; $i <= 10; $i+=4 ){ 
        echo $i; 
      

  2.   

    for ($i = 1; $i <= 10; $i++) 
    没有仔细研究手册,呵呵.for loops are the most complex loops in PHP. They behave like their C counterparts. The syntax of a for loop is: for (expr1; expr2; expr3)
        statementThe first expression (expr1) is evaluated (executed) once unconditionally at the beginning of the loop. In the beginning of each iteration, expr2 is evaluated. If it evaluates to TRUE, the loop continues and the nested statement(s) are executed. If it evaluates to FALSE, the execution of the loop ends. At the end of each iteration, expr3 is evaluated (executed). Each of the expressions can be empty or contain multiple expressions separated by commas. In expr2, all expressions separated by a comma are evaluated but the result is taken from the last part. expr2 being empty means the loop should be run indefinitely (PHP implicitly considers it as TRUE, like C). This may not be as useless as you might think, since often you'd want to end the loop using a conditional break statement instead of using the for truth expression. 
      

  3.   

    几乎所有语言的for循环都可以调步长
      

  4.   


    for($i=1;$i<=10;)
    {
        echo $i;
        $i+=4;
    }