ad

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

how to create login form in php

php if else statements

bdi tag in html

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

 php echo function

html button tag

php program to print alphabet pattern H

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. css column gap property

  3. html iframe

  4. php program palindrome number

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

javascript bitwise operators

forgot password form

how to create home page design

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

html table tag

html id Attribute

css column gap property

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

php program using sum of digits

registration form in php

article tag in html

how to create login form

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 for loop

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 triangle pattern

php array types

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

html datetime picker

html form input type

how to create contact form html and css

php program to print hourglass star pattern

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


Program to print reverse right Half Pyramid pattern in php


Reverse right Half Pyramid in php

1] Reverse right Half Pyramid in php 

Example :-

<?php
for($i=0;$i<=5;$i++)
{
  for($j=5-$i;$j>=1;$j--)
  {
    echo"*";
//change only  echo ""; value
    //for example :- 1,d,4,h,9,...etc
  }
  echo "<br>";
}
?>
Reverse right Half Pyramid in php

Output :-

reverse right Half Pyramid in php



1] Reverse right Half Pyramid in php 

Example :-


<?php
for($i=0;$i<=5;$i++)
{
  for($j=5-$i;$j>=1;$j--)
  {
    echo"A";
    //change only  echo ""; value
    //for example :- 1,d,4,h,9,...etc
  }
  echo "<br>";
}
?>


Reverse right Half Pyramid in php

Output :-

reverse right Half Pyramid in php



how to create feedback form

php program to print heart star pattern