PHP Pyramid Part VIII

PHP Pyramid Part 8
PHP Pyramid Part 8

<?php
 $limit = 5;
 for($i=0;$i<=$limit;$i++) 
 { 
   for($j=$limit;$j>$i;$j--)
   {
     echo "&nbsp;&nbsp;";
   }
   for($k=1;$k<=$i;$k++)
   {
     echo $k;
   }
   echo "<br/>";
 }
?>
Output:
    1
   12
  123
 1234
12345

 

You may also like...

Leave a Reply