Write a program to print pyramid patterns in php

In this article, We’ll write a program to print differnt different pyramid patterns in php.




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

That’s it!. Please share your thoughts or suggestions in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *