How to make the number triangle pattern in PHP
In this post we will give you information about How to make the number triangle pattern in PHP. Hear we will give you detail about How to make the number triangle pattern in PHPAnd how to use it also give you demo for it if it is necessary.
PHP for loop makes program easy. i take advantage of for loop usually.
Simple step to draw full shape of number triangle in easiest way
- for($i=;$i<=9;$i++){
- for($d=10-$i;$d>;$d--){
- echo" ";
- }
- for($j=1;$j<=$i;$j++){
- echo" ".$i." ";
- }
- echo"<br>";
- }
- for($i=8;$i>=1;$i--){
- for($d=;$d<=9-$i;$d++){
- echo" ";
- }
- for($j=$i;$j>=1;$j--){
- echo" ".$i." ";
- }
- echo"<br>";
- }
for($i=0;$i<=9;$i++){ for ($d=10-$i; $d > 0; $d--) { echo " "; } for($j=1;$j<=$i;$j++){ echo " ".$i." "; } echo "<br>"; } for($i=8;$i>=1;$i--){ for ($d=0; $d <= 9-$i; $d++) { echo " "; } for($j=$i;$j>=1;$j--){ echo " ".$i." "; } echo "<br>"; }
Hope this code and post will helped you for implement How to make the number triangle pattern in PHP. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs