PHP Tutorial

PHP Home

PHP Functions

PHP String Functions

PHP Interview Programs

PHP Common ProgramsPHP Array ProgramsPHP Converter ProgramsPHP Star Patterns ProgramPHP Number Patterns ProgramPHP Alphabet Patterns Program

PHP Reference

ASCII Table

PHP Number Pattern 23

Last Updated:

PHP Number Pattern 23

Try to print the following number pattern using PHP.

Print This Output
1234554321
1234**4321
123****321
12******21
1********1

Source Code

PHP Compiler
<?php for($i=5; $i>=1; $i--) { for($j=1; $j<=$i; $j++) echo $j; for($k=$i; $k<5; $k++) echo "**"; for($m=$i; $m>=1; $m--) echo $m; echo "<br>"; } ?>

Share this Page

Meet the Author