This is not new concept, you need to follow same concept like C programming to print number pattern in php. every time on interview ask question print pattern. this is important note please keep it. Output : Code : <?php for($a=1; $a<=5; $a++) { for($b=$a; $b>=1; $b--) { echo "$b"; } echo "<br>"; } ?> Now simple print one column then only one for loop use to print pattern This is not new concept, you need to follow same concept like C programming to print star pattern or triangle of star. Output : Code : <?php for ($row = 1; $row <= 5; $row++) { echo "* </br>"; } ?> print * in square size as following manner and please follow following code : Code : <?php for ($row = 1; $row <= 5; $row++) { for ($col = 1; $col <= 5; $col++) { echo '* '; } echo "</br>"; } ?> PHP start pattern of trangle as output and code here : Output : Code ...