How to make the number triangle pattern in PHP

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

  1. for($i=0;$i<=9;$i++){
  2.     for($d=10-$i;$d>0;$d--){
  3.         echo"&nbsp;&nbsp;";
  4.     }
  5.     for($j=1;$j<=$i;$j++){
  6.         echo"&nbsp;".$i."&nbsp;";
  7.     }
  8.     echo"<br>";
  9. }
  10. for($i=8;$i>=1;$i--){
  11.     for($d=0;$d<=9-$i;$d++){
  12.         echo"&nbsp;&nbsp;";
  13.     }
  14.     for($j=$i;$j>=1;$j--){
  15.         echo"&nbsp;".$i."&nbsp;";
  16.     }
  17.     echo"<br>";
  18. }
for($i=0;$i<=9;$i++){
	for ($d=10-$i; $d > 0; $d--)  {
		echo "&nbsp;&nbsp;";
	}
	for($j=1;$j<=$i;$j++){
		echo "&nbsp;".$i."&nbsp;";
	}
	echo "<br>";
}
for($i=8;$i>=1;$i--){
	for ($d=0; $d <= 9-$i; $d++)  {
		echo  "&nbsp;&nbsp;";
	}
	for($j=$i;$j>=1;$j--){
		echo "&nbsp;".$i."&nbsp;";
	}
	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

For More Info See :: laravel And github