PHP Star Triangle Program printing Source Code

Today, We want to share with you PHP Star Triangle Program printing.In this post we will show you print * triangle in php, hear for Simple PHP Create STAR TRIANGLE, we will give you demo and example for implement.In this post, we will learn about PHP programs for printing pyramid patterns with an example.

PHP Star Triangle Program printing

There are the Following The simple About PHP Star Triangle Program printing Full Information With Example and source code.

As I will cover this Post with live Working example to develop Programs to Print Pyramid Star Patterns Using PHP, so the some PHP Alphabet Triangle Program for this example is following below.

Read Also:  php lowercase - The Best PHP 3 Examples

How to make the “STAR TRIANGLE” in PHP ?

using for or foreach loop

    $no=1;
    for($i=1; $i<=5; $i++) { // simple foreach iterates over number of rows
        for($j=$i; $j<=4; $j++) {
            echo "  ";
        }
        for($cd=1; $cd<=$no; $cd++)  {
            echo "*";
        }
        for($ld=$no; $ld>1; $ld--) {
            echo "*";
        }
        echo "<br>";
        $no++;
    }

PHP Star Triangle Program printing
PHP Star Triangle Program printing

Php Star Pattern Program
<?php
//PHP Simple Outer loop for changing some rows
for ($i = 1; $i <= 5; $i++) {
 //Loop added for spacing
 for ($j = $i; $j <= 5; $j++) {
	echo "  ";
 }
 
 //PHP Loop to print star as needed
 for ($jd = 1; $jd < ($i * 2); $jd++) {
	echo "*";
 }
 echo "</br>";
}
?>

PHP Program For Right Angle Inverted Triangle Using Star

for ($i = 5; $i >= 1; $i--) {
 for ($j = 5; $j > $i; $j--) {
 echo "  ";
 }
 for ($jd = 1; $jd <= $i; $jd++) {
 echo "*";
 }
 echo "</br>";
}

Angular 6 CRUD Operations Application Tutorials

Read :

Read Also:  PHP Laravel get months between two dates

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP Star Triangle Program printing.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.