$tam = 10; echo "<pre>"; for ($i = 0; $i < $tam; $i++) { echo str_pad(str_repeat("*", $i * 2) . "*", $tam * 2 + 1, " ", STR_PAD_BOTH) . "<br/>"; } $cad="*"; for ($i = 0; $i < $tam; $i++) { echo str_pad($cad, $tam * 2 + 1, " ", STR_PAD_BOTH) . "<br/>"; $cad.="**"; } ?> </pre> <table border="1"> <?php for ($i = 0; $i < $tam; $i++) { ?> <tr> <?php for ($j = 0; $j < $tam; $j++) { ?> <td><?=$j==$i || $j==$tam-1-$i?"1":" " ?></td> <?php } ?> </tr> <?php } ?></table>