< >

phptabelle.php


Quell Code


<?php

$max_multiplier = 10;

?>

<style>
    td, th {
        width: 3ex;
        text-align: right;
    }
</style>

<table>
    <tr>
        <th></th>
        <?php foreach (range(1, $max_multiplier) as $x): ?>
            <th><?= $x ?></th>
        <?php endforeach; ?>
    </tr>
    <?php foreach (range(1, $max_multiplier) as $y): ?>
        <tr>
            <th><?= $y ?></th>
            <?php foreach (range(1, $max_multiplier) as $x): ?>
                <td><?= $x * $y ?></td>
            <?php endforeach; ?>
        </tr>
    <?php endforeach; ?>
</table>