(adsbygoogle = window.adsbygoogle || []).push({}); Learn PHP star patterns programs to print different numbers from zero to nine (0-9) with star pattern. I have assembled a list of number patterns to practice for both novice as well as intermediate programmers. Pretty easy right?. In this post we will show you Number Patterns in PHP, hear for PHP for loop â Exercises, Practice, Solution we will give you demo and example for implement. Print Triangle of Stars in PHP =1; \$a--) { if(\$a%2 != 0) { for(\$b=5; \$b>=\$a; \$b--) { echo "* "; } echo "
"; } } for(\$a=2; \$a<=5; \$a++) { if(\$a%2 != 0) { for(\$b=5; \$b>=\$a; \$b--) { echo "* "; } echo "
"; } } ?> The logic to print the given pattern would be similar as the previous pattern we just did. In this post, we will learn about program to print pyramid of numbers in php with an example.. PHP Print number Pattern Program This Program first takes the numbers of rows and then prints pattern using nested for loops. If you have any need help with any tutorial or have business inquires please get in touch. Here we will try to print number 1 in the first row, number 1 and 2 in the second row, number 1, 2 and 3 in the third row and it will continue like that. Let us now try to print the pyramid pattern on numbers in yet another style. Notify me of followup comments via e-mail. Precision. Print number Pattern in PHP. Number pattern is a series of numbers arranged in specific order. Half Pyramid of * * * * * * * * * * * * * * * * #include int main() { int i, j, rows; printf("Enter â¦ Reply Delete Pattern 1: \$i; \$k--) { //print one space throgh html ; echo " "; } for(\$j=1;\$j<=\$i;\$j++) { echo "*"; } echo "
"; } ?> Output Pattern 5 This is a square pattern with each row having 5 columns and there are 5 rows and the pattern looks as shown below: 5 4 3 2 1 4 3 2 1 5 3 2 1 5 4 2 1 5 4 3 1 5 4 3 2 My code is as below to get the pattern but I am not able reset the value in each when the counter comes to â¦ If you can notice, there are N - i spaces per row (where i is the current row number). "; \$k++; } echo "