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 " ";
}
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 ' ';
}
}
}
echo'<br>';
}
?>
php program to print hollow pyramid star pattern
Post a Comment