php program to print heart star pattern

php program to print heart star pattern

php program to print heart star pattern

Example:-

<?php
$size =6;
for($i=$size/2;$i<$size;$i+=2)
{
    for($j=1;$j<$size-$i;$j+=2)
    {
        echo "&nbsp;&nbsp;";
    }
    for($j=1;$j<$i+1;$j++)
    {
        echo '*';
    }
    for($j=1;$j<$size-$i+1;$j++)
    {
        echo "&nbsp;&nbsp;";
        }
        for($j=1;$j<$i+1;$j++)
        {
            echo "*";
        }
        echo '<br>';
}
for($i=$size;$i>0;$i--)
{
    for($j=0;$j<$size-$i; $j++)
    {
        echo "&nbsp;&nbsp;";
    }
    for($j=1;$j<$i*2;$j++)
    {
        echo '*';
    }
    echo "<br>";
}
?>

php program to print heart star pattern

Output :-

php program to print heart star pattern


Related Post :-

php form handing

php variable

html ordered list

php cookies

Comments

Popular posts from this blog

What Is CSS Text Color in 2026

CSS Padding Property Explained

CSS Outline Color Property in 2026