Home >> PHP >> How to print inverted half pyramid using star in PHP

How to print inverted half pyramid using star in PHP

$rows=5;

for($i=$rows;$i>=1;$i--){

      for($j=1;$j<=$i;$j++){

               echo "*";

      }

     echo "\n";

}

Output

*        *           *          *           *

*        *           *           *

*         *          *

*         * 

Post Your Comment

Next Questions
How to print inverted half pyramid using number
How to print half pyramid using one to ten number
How to print pyramid pattern using star
How to print half pyramid pattern using star
How to print half pyramid pattern using star after 180 degree rotation
display errors
string to array
array to string
how to split string into array
How to convert array to string
Difference between exit and die
Set Cookie
Access Cookie
Remove Cookie
how to remove \r\n from string
how to remove new lines from string
how to remove nbsp from string
How to remove all whitespace from a string
How to convert array to string separated by comma
How to list last 12 months from current month
Get the last 12 months from current month
How to list last 6 months from current month
Get the last 6 months from current month
How to list last 12 months from current month by loop
Get the last 12 months from current month by loop

Copyright ©2022 coderraj.com. All Rights Reserved.