Category: PHP Pyramids

PHP Pyramid Part 12

PHP Pyramid Part XII

<?php $limit = 5; for($i=0;$i<=$limit;$i++) { for($j=$limit;$j>=$i;$j–) { echo “&nbsp;&nbsp;”; } echo “1”; for($x=1;$x<=$i;$x++) { echo “0”; } echo “1”; echo “<br/>”; } ?> Output: 11 101 1001 10001 100001 1000001  

PHP Pyramid Part 11

PHP Pyramid Part XI

<?php $limit = 5; for($i=0;$i<=$limit;$i++) { for($j=$limit;$j>=$i;$j–) { echo “&nbsp;&nbsp;”; } for($x=0;$x<=$i;$x++) { if($x==0) { echo “1”; continue; } echo “0”; } echo “<br/>”; } ?> Output; 1 10 100 1000 10000 100000  

PHP Pyramid Part 10

PHP Pyramid Part X

<?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: * ** *** **** *****  

PHP Pyramid Part 9

PHP Pyramid Part IX

<?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 $i; } echo “<br/>”; } ?> Output: 1 22 333 4444 55555  

PHP Pyramid Part 8

PHP Pyramid Part VIII

<?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  

PHP Pyramid Part 7

PHP Pyramid Part VII

<?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 $k; } echo “<br/>”; } ?> Output: 1 21 321 4321 54321