/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$c=1; $n = 9; for($i=1;$i<=$n;$i++) { for($j=$i;$j<$n;$j++) { echo " "; } for($k=1;$k<=$c;$k++) { if($k%2==0) echo " "; else echo '*'; } echo "<br />"; $c+=2; } for($i=$n;$i>=1;$i--) { for($j=$i;$j<$n;$j++) { echo " "; } for($k=$c-1;$k>1;$k--) { if($k%2==0) echo " "; else echo '*'; } echo "<br />"; $c-=2; }