while ($i<5) { 

      if ($i>1) { 
           break;
        } 
      $i++; 
} 

ok, let's suppose now $i is 2, what will happen, will it
-$i is 4(break stop the inner if)
-$i is 2(break stop the while loop)
-$i is 3(break while but does the rest of while)

    break has no effect on an if. It will simply exit the while.

      What I don't understand is why you needed to post? You had taken the time to write the example code which would have tested the situation, and tested it perfectly. Surely it took longer to make the post than it would have done to run the script and find out for yourself.

        Write a Reply...