php program to print hollow pyramid star pattern

 

php program to print hollow pyramid star pattern

php program to print hollow pyramid star pattern 

Example :-

<?php
$size=5;
for($i=0;$i<$size; $i++)
{
    for($j=0; $j<$size-$i-1;$j++)
    {
        echo "&nbsp;&nbsp;";
    }
    for($k=0;$k<2*$i+1;$k++)
    {
        if($i===0|| $i===$size-1)
        {
           echo '*';
           //only change value of echo '';
           //for example - 2,e,f,a,B,5..etc
        }
        else{
            if($k===0||$k===2*$i){
                echo '*';
            }
            else {
                echo '&nbsp;&nbsp;';
            }
        }
    }
    echo'<br>';
}
?>

php program to print hollow pyramid star pattern 

Output :-

php program to print hollow pyramid star pattern


Related  Post :-

how to create login form in php

php if else statements

bdi tag in html

Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

HTML Input Type Submit Syntax and Example