Home >Backend Development >PHP Tutorial >PHP implements multiplication table (code example)

PHP implements multiplication table (code example)

藏色散人
藏色散人Original
2019-03-27 09:33:5221923browse

This article will introduce to you how to use PHP to implement the familiar multiplication table. It is simple and interesting. Friends who are interested can refer to it~

PHP implements multiplication table (code example)

PHP method to implement the multiplication table, the code is as follows:

<!DOCTYPE html>
<html>
<body>
<table align="left" border="1" cellpadding="3" cellspacing="0">
    <?php
    for($i=1;$i<=9;$i++)
    {
        echo "<tr>";
        for ($j=1;$j<=9;$j++)
        {
            echo "<td>$i * $j = ".$i*$j."</td>";
        }
        echo "</tr>";
    }
    ?>
</table>
</body>
</html>

Here we mainly use a for loop to create this table, which is very simple.

Output:

PHP implements multiplication table (code example)

Related recommendations: "PHP Tutorial"

This article is about PHP implementation ninety-nine An introduction to the multiplication table method, I hope it will be helpful to friends who need it!

The above is the detailed content of PHP implements multiplication table (code example). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn