Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   While loop inside while loop (http://www.go4expert.com/forums/loop-inside-loop-t25489/)

karthickr 10Apr2011 09:41

While loop inside while loop
 
Hi, I am new to PHP. Can anyone tell me how to use while loop inside while loop?

shabbir 10Apr2011 10:55

Re: While loop inside while loop
 
Code:

While (SomeCondition)
{
    While (SomeCondition)
    {

    }
}


underground_devil 14May2011 10:30

Re: While loop inside while loop
 
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


All times are GMT +5.5. The time now is 22:39.