PHP Pyramid Part X

PHP Pyramid Part 10
PHP Pyramid Part 10

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

 

You may also like...