I need to make a script in PHP7 that generates a table of 10x10 and that in the diagonal is formed by ones and the rest by zeros. I've been documented and here describes how to get it out of a database data, however I do not know how to give the values of the diagonal or 0 by default. The PHP:
<?php
$end=10;
$rows=ceil($end/8);
$x=0;
$start=0;
?>
<table>
<?php
while($x<=$rows) {
echo "<tr>";
for ($y = 0; $y < 8; $y++, $start++) {
if ($start <= $end) echo "<td>$start</td>";
}
echo "</tr>";
$x++;
}
?>
</table>