Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: While loops

  1. #1
    New to the CF scene
    Join Date
    Nov 2007
    Location
    Harriston, Ontario
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    While loops

    I have to put a while loop in an assignment and I was wondering if someone could explain what it does and possibly give me an example then I can at least attempt it on my own, but an explination will be just fine thanks!

  • #2
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts

  • #3
    Regular Coder
    Join Date
    Nov 2006
    Posts
    246
    Thanks
    13
    Thanked 26 Times in 24 Posts
    http://us3.php.net/manual/en/control...ures.while.php

    Just a very basic example:

    PHP Code:
    $i 1;
    while (
    $i <= 10) {
        echo 
    "This is line $i<br>"// print line number
        
    $i++; // add 1 to $i

    Prints:

    This is line 1
    This is line 2
    This is line 3
    This is line 4
    This is line 5
    This is line 6
    This is line 7
    This is line 8
    This is line 9
    This is line 10
    Last edited by Majoracle; 11-19-2007 at 11:05 PM.


  •  

    Posting Permissions

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