Home > Article > Backend Development > PHP implements multiplication table (code example)
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 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:
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!