PLEASE RELOAD
Simple Use for While Loop



A while loop can also become a webpage tool. The following was made with a while loop. One action takes the width of 2 and increases it each loop 2 pixels till it gets to 30. The second action takes the 30 and says if the width is more than or equal to 4; subtract 2 pixels every loop. Giving you a very nice decoration for your webpage.



<?

$width = 2;

while ($width <=30 )

{

$width = $width + 2;

$tbl="<center><table cellpadding=0 cellspacing=0 border=0><tr><td bgcolor=maroon height=1 width=$width> </td></tr></table></center>";

echo $tbl;

}

//END ONE: TO END PUT CLOSING PHP TAG //TO START HERE: PUT OPENING PHP TAG

$width2 = 30;

while ($width2 >=4 )

{

$width2 = $width2 - 2;

$tbl="<center><table cellpadding=0 cellspacing=0 border=0><tr><td bgcolor=maroon height=1 width=$width2> </td></tr></table></center>";

echo $tbl;

}

?>




Back SiteMap