Results 1 to 1 of 1

Thread: While loop

  1. #1
    peam
    peam is offline
    Guest
    Join Date
    2013 Nov
    Posts
    3
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Rep Power
    0

    Red face While loop

    Tutorial WHILE LOOP for PHP.

    PHP Code:
    $x 0;            // define $x
    WHILE ($x<9) {     // do something while $x<9
        
    echo $x;       // do this thing
        
    $x++;          // increase $x
    }                  // exit loop when $x>=9 
    Result from example is "0123456789".

    WHILE Loop have to check condition ($x<9) at first. If the condition is TRUE it will begin do something in loop.

    Next time I will show you about "DO WHILE LOOP". about how different from WHILE LOOP and how to use.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •