1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

While loop inside while loop

Discussion in 'PHP' started by karthickr, Apr 10, 2011.

  1. karthickr

    karthickr New Member

    Joined:
    Apr 10, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi, I am new to PHP. Can anyone tell me how to use while loop inside while loop?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    Code:
    While (SomeCondition)
    {
        While (SomeCondition)
        {
    
        }
    }
     
  3. underground_devil

    underground_devil New Member

    Joined:
    Jan 24, 2011
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    PHP developer ,trainer
    Location:
    Punjab
    example
    PHP:
    <?php
    $i
    =1;
    while(
    $i<5)
          {
              
    $j=1
               
    while($j<$i)
               {
                echo 
    $j." ";
                 
    $j++;
                }
          echo 
    "<br>";
          }
    out put would be
    1 2 3 4 5
    1 2 3 4
    1 2 3
    1 2
    1
     

Share This Page