Friday, May 31, 2024

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 :-

php program to print hollow triangle star pattern


php program to print hollow triangle star pattern


 php program to print hollow triangle star pattern 

Example :-

<?php
$size =5;
for($i=1;$i<=$size;$i++)
{
    for($j=0;$j<$i;$j++)
    {
        if($i!=$size)
        {
            if($j==0||$j==$i-1)
            {
                echo '*';
            }
            else{
                echo "&nbsp;&nbsp;";
            }
        }
        else{
            echo'*';
        }
    }
    echo '<br>';
}
?>

php program to print hollow triangle star pattern 

Output:-

php program to print hellow triangle star pattern


Related Post :-

 print inverted right half pyramid print php

reverse right half pyramid in php

left pascal star pattern in php

inverted pyramid star pattern in php

print half diamond pattern

print diamond pattern program php

print left half pyramid in php

php program to print inverted right half pyramid

 

php program to print inverted right half pyramid

php program to print inverted right half pyramid

Example:-

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

php program to print inverted right half pyramid

Output:-

php program to print inverted right half pyramid


  1. Related Post:-
  2. reverse right half pyramid in php

    left pascal star pattern in php

    inverted pyramid star pattern in php

    print half diamond pattern


php program to print inverted left half pyramid pattern

php program to print inverted left half pyramid

php program to print inverted left half pyramid


php program to print inverted left half pyramid

Example :-

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

php program to print inverted left half pyramid

Output:-

php program to print inverted left half pyramid


Related post :-

square pattern in php

reverse right half pyramid in php

print left half pyramid in php

inverted pyramid star pattern in php

PHP Program to Print Alphabet Pattern H

print half diamond pattern

print diamond pattern program php

php program to print left half pyramid star pattern

 php program to  print left half pyramid 

php program to  print left half pyramid

php program to  print left half pyramid 

Example :-

<?php
for($i=1;$i<=5;$i++)
{
for($j=4;$j>=$i;$j--)
{
    echo "&nbsp;&nbsp;";
}
for($k=1;$k<=$i;$k++)
{
    echo '*';
    //change only value of the
    //echo' *';
    //for example :- 1,s,q,h,a,A....etc
}
echo '<br>';
}
?>

php program to  print left half pyramid 

Output:- 

php program to  print left half pyramid


Related  Post :-

print triangle pattern php program

PHP program to print Alphabet Pattern K 

square pattern in php

reverse right half pyramid in php

left pascal star pattern in php

inverted pyramid star pattern in php

print half diamond pattern

print diamond pattern program php

php program to print triangle pattern

 

php program to print triangle pattern

php program to print triangle pattern


php program to print triangle pattern

Example :-

<?php
//Star Pyramid Size
$size = 7;
for($i=1;$i<=$size;$i++){
    for($j=1;$j<=$size-$i;$j++)
    {
        echo "&nbsp;&nbsp;";
    }
    for($k=1;$k<=$i;$k++){
             
        echo "*&nbsp;&nbsp;";
    }
echo "<br />";
}
?>

php program to print triangle pattern

Output:-

php program to print triangle pattern


Related Post :-

print half diamond pattern

print diamond pattern program php

square pattern in php

reverse right half pyramid in php

left pascal star pattern in php

inverted pyramid star pattern in php

php program to print diamond pattern

  

php program to print diamond pattern

php program to print diamond pattern


php program to print diamond pattern

Example:-

<?php
echo "<pre>";
for($i=1;$i<8;$i++)
{
    for($j=$i; $j<8;$j++)
    echo "&nbsp;&nbsp;";
for($j=2*$i-1;$j>0;$j--)
echo("&nbsp;*");
echo"<br>";
}
$n =8;
for($i=8;$i>0;$i--){
    for($j=$n-$i;$j>0;$j--)
    echo "&nbsp;&nbsp;";
 for($j=2*$i-1;$j>0;$j--)
 echo ("&nbsp;*");
echo "<br>";

}
echo"</pre>";
?>

 php program to print diamond pattern

Output :-
php program to print diamond pattern


Related Post :-

php program to print half diamond pattern

 php program to print half diamond pattern

php program to print half diamond  pattern

php program to print half diamond  pattern

Example :-

<?php
for($i=5;$i>=1;$i--)
{
    if($i%2!=0)
    {
        for($j=5;$j>=$i;$j--)
        {
        echo "*";

    }
  echo"<br>";
}
}
for($i=2;$i<=5;$i++)
{
    if($i%2!=0)
    {
        for($j=5;$j>=$i;$j--)
        {
            echo "*";
        }
        echo "<br>";
    }
}
?>

php program to print half diamond  pattern

Output:-

php program to print half diamond  pattern



Related Post :-


php program to print increasing triangle

php program to print increasing triangle 


php program to print increasing triangle


php program to print increasing triangle  

Example :-

<?php
for($i=0;$i<=5;$i++){
for($j=1;$j<=$i;$j++){
echo "*";
}
echo '<br>';
}
?>

php program to print increasing triangle  

Output:-

php program to print increasing triangle


php program to print increasing triangle 

Example :- 

<?php
for($i=0;$i<=5;$i++){
for($j=1;$j<=$i;$j++){
echo "A";
}
echo '<br>';
}
?>

php program to print increasing triangle  

Output:-

right half pyramid in php program,php program to print increasing triangle,


Related Post:-

inverted pyramid star pattern in php

left pascal star pattern in php

php program to print alphabet pattern C 

php program to print alphabet pattern j

php program to print alphabet pattern m

square pattern in php

reverse right half pyramid in php

Program to print left pascal star pattern in php

left pascal star pattern in php

 left pascal star pattern in php

Example :-

<?php
    $size = 5;
   
    for ($i = 1; $i <= $size; $i++) {
        for ($j = 0; $j < $size - $i; $j++) {
            echo "&nbsp;&nbsp;";
        }
        for ($k = 0; $k < $i; $k++) {
            echo "*";
        }
        echo "<br>";
    }
    for ($i = 1; $i <= $size - 1; $i++) {
        for ($j = 0; $j < $i; $j++) {
            echo "&nbsp;&nbsp;";
        }
        for ($k = 0; $k < $size - $i; $k++) {
            echo "*";
        }
        echo "<br>";
    }
?>
left pascal star pattern in php

Output:-

left pascal star pattern in php


left pascal star pattern in php

Example :-

<?php
    $size = 5;
   
    for ($i = 1; $i <= $size; $i++) {
        for ($j = 0; $j < $size - $i; $j++) {
            echo "&nbsp;&nbsp;";
        }
        for ($k = 0; $k < $i; $k++) {
            echo "b";
        }
        echo "<br>";
    }
    for ($i = 1; $i <= $size - 1; $i++) {
        for ($j = 0; $j < $i; $j++) {
            echo "&nbsp;&nbsp;";
        }
        for ($k = 0; $k < $size - $i; $k++) {
            echo "b";
        }
        echo "<br>";
    }
?>

left pascal star pattern in php

Program to print inverted Pyramid star pattern in php

Inverted Pyramid star pattern in php

 Inverted Pyramid star pattern in php

Example :-

<?php
echo "<pre>";
$n =10;
for($a=10; $a>0;$a--)
{
  for($b=$n-$a; $b>0; $b--)
  echo "&nbsp;&nbsp;";
for($b=2*$a-1; $b>0; $b--)
echo "&nbsp;*";
//change only  echo ""; value
    //for example :- 1,d,4,h,9,...etc
echo"<br>";
}
echo"</pre>";
?>

 Inverted Pyramid star pattern in php 

Output :-

inverted Pyramid star pattern in php

2] Inverted Pyramid star pattern in php

Example :-

<?php
echo "<pre>";
$n =10;
for($a=10; $a>0;$a--)
{
  for($b=$n-$a; $b>0; $b--)
  echo "&nbsp;&nbsp;";
for($b=2*$a-1; $b>0; $b--)
echo ("&nbsp;A");
//change only  echo ""; value
    //for example :- 1,d,4,h,9,...etc
echo"<br>";
}
echo"</pre>";
?>

 Inverted Pyramid star pattern in php 

Output :-

inverted Pyramid star pattern in php


Related Post :-

reverse right half pyramid in php

square pattern in php

PHP Program to Print Alphabet Pattern H

PHP Program to print Alphabet Pattern B

 php program to print alphabet pattern j

 php program to print alphabet pattern l