Print number Pattern in PHP


Prev Tutorial Next Tutorial

Print number Pattern Program in PHP

This is not new concept, you need to follow same concept like C programming to print number pattern in php.

Print number Pattern in PHP

<?php
 
for($a=1; $a<=5; $a++)
{
 for($b=$a; $b>=1; $b--)
{
echo "$b";
}
echo "<br>";
}

?>

Output

	
1
21
321
4321

Print number Pattern in PHP

<?php

for($a=5; $a>=1; $a--)
{
for($b=1; $b<=$a; $b++)
{
echo $b;
}
 echo "</br>";
}

?>

Output

	
12345
1234
123
12
1

Print number Pattern in PHP

<?php

for($a=5; $a>=1; $a--)
{
for($b=5; $b>=$a; $b--)
{
echo $b;
}
 echo "</br>";
}

?>

Output

	
5
54
543
5432
54321

Prev Tutorial Next Tutorial

Advertisements




Download Projects