Pyramid creation using php
Below are the sample code for pyramid creation using php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
$pyramid_count=10; for($i=0;$i<$pyramid_count;$i++) { for($j=1;$j<$i;$j++) { echo " "; } for($k=1; $k<=$pyramid_count-$i; $k++) { echo "*"; } for($s=0;$s<$pyramid_count;$s++) { echo " "; } echo "</br>"; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
$pyramid_count=10; for($i=0;$i<$pyramid_count;$i++) { for($j=1;$j<$pyramid_count-$i;$j++) { echo " "; } for($k=1; $k<=$i; $k++) { echo "*"; } for($s=0;$s<$pyramid_count-$i;$s++) { echo " "; } echo "</br>"; } |