PHP code to create diamond symbol?
author
,
Aspirant Programmer

How to create diamond symbol by in PHP.

  • Total 1 Answer
  • 250
Can You answer this question?
author
,
Aspirant Programmer

If you want to write PHP code to get above diamond symbol you can use below code:

 

</p> <p>for($i=0;$i<=5;$i++)<br /> {  <br />   for($k=5;$k>=$i;$k--)<br />   {  <br />     echo "  ";  <br />   }  <br />   for($j=1;$j<=$i;$j++)<br />   {  <br />     echo "*  ";  <br />   }  <br />   echo "<br>";  <br /> }  <br /> for($i=4;$i>=1;$i--)<br /> {  <br />   for($k=5;$k>=$i;$k--)<br />   {  <br />     echo "   ";  <br />   }  <br />   for($j=1;$j<=$i;$j++)<br />   {  <br />     echo "*  ";  <br />   }  <br />   echo "<br>";  <br /> }  </p> <p>