Write Below Pattern Using for loop Coding & Print Pattern in Php.

Output of Print Pattern

*
**
***
****
*****
******
*****
****
***
**
*

Php Print Pattern Code in Below 

<?php

 for($i=0;$i<=6;$i++)
{
   // echo $i;
   for($j=0;$j <$i;$j++)
   {
echo "*";
    }
echo "<br>";
 }
 for($i=4;$i >=0; $i--)
{
for($j=0;$j <= $i;$j++)
    {
echo "*";
    }
    echo "<br>";
 }
?>

This program is print the follows pattern using the for loop use print the two main for loop and two are sub for loop and this logic is we create the first loop is started 0 to 6 and other is start 4 to 0 so it will print the above pattern.

Comments

Popular posts from this blog