This is easy and too much loop less code to write diamond and triangle shapes
Following code is diamond with the technique of css inline styles
echo '<p style="text-align:center;font-family: Verdana;line-height: 5px;">'; for($I=0;$I<=5;$I++){ echo str_repeat('*',$I); echo '<br />'; } for($D=6;$D>=1;$D--){ echo str_repeat('*',$D); echo '<br />'; } echo '</p>';
Result of diamond code
*
**
***
****
*****
******
*****
****
***
**
*
Following code is normal triangle with the technique of css inline styles
echo '<p style="text-align:left;font-family: Verdana;line-height: 5px;">'; for($I=0;$I<=5;$I++){ echo str_repeat('*',$I); echo '<br />'; } for($D=6;$D>=1;$D--){ echo str_repeat('*',$D); echo '<br />'; } echo '</p>';
Result of triangle code
*
**
***
****
*****
******
*****
****
***
**
*