Jump to content

How to use while loop inside while loop?


karthickr

Recommended Posts

im just gonna try write this now on the fly, lol

 

$verticalstars = 10;

$horizontalstars = 10;

$countvert;

$counthori;

for($countvert = 0;$countvert < $verticalstars;$countvert++)

{

  for($counthori = 0;$counthori < $horizontalstars;$counthori++)

      {

            echo "*";

        }

  echo "<br>";

 

}

 

so the first loop is how many 'rows' , and inside each loop of a row is the number of 'cols' per row, the second loop executes completely, then is recalled when the first loop loops again. hope that makes some sense

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.