While loop inside while loop

karthickr's Avatar, Join Date: Apr 2011
Newbie Member
Hi, I am new to PHP. Can anyone tell me how to use while loop inside while loop?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Code:
While (SomeCondition)
{
    While (SomeCondition)
    {

    }
}
0
underground_devil's Avatar, Join Date: Jan 2011
Go4Expert Member
example
PHP Code:
<?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