HOW TO MAKE A STAR POLYGON IN PHP ?

HOW TO MAKE A STAR POLYGON IN PHP ?

In this post we will give you information about HOW TO MAKE A STAR POLYGON IN PHP ?. Hear we will give you detail about HOW TO MAKE A STAR POLYGON IN PHP ?And how to use it also give you demo for it if it is necessary.

We are going to know how to make a star polygon in php using for loop. Here we are using eight for loops. first loop indicates always the number of row.
Second for loop are using to give space. Third loops are using to left side triangle with star.
Fourth for loop are using for right side triangle with star.
Sixth for loop is using to give space and seventh for loop is using to left triangle with star in reverse order.
Eight for loop is using for right side triangle with star in same reverse order.

 $m=1; $n=5;
for($i=1; $i<=5; $i++) {
    for($j=$i; $j<=4; $j++) {
        echo"  ";
    }
    for($k=1; $k<=$m; $k++)  {
        echo"*";
    }
    for($c=$m; $c>1; $c--) {
        echo"*";
    }
    echo"
"
;
    $m++;
}
 
for($i=1; $i<=5; $i++) {
    for($j=$i; $j>=1; $j--) {
        echo"  ";
    }
    for($k=$n; $k>1; $k--) {
        echo"*";
    }
    for($c=$n-1; $c>1; $c--) {
        echo"*";
    }
    echo"< br>";
    $n--;
}

Hope this code and post will helped you for implement HOW TO MAKE A STAR POLYGON 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