PHP double-layer loop implements ninety-nine multiplication tables

墨辰丷
Release: 2023-03-26 12:22:01
Original
2730 people have browsed it

This article mainly introduces PHP double-layer loop to implement the multiplication table. Interested friends can refer to it. I hope it will be helpful to everyone.

The examples are as follows:

<?php
  echo "<table width = 800 height = 200 border = 1>";     //输出边框
  for($i=1;$i<=9;$i++)         //控制每行
  {
    echo "<tr>";               //输出一行
  for($j=1;$j<=$i;$j++)     //控制每列
  {
    echo "<td>";        //输出一列
    echo $i.&#39;*&#39;.$j.&#39;=&#39;.$i*$j;
    echo "</td>";
  }
  echo "</tr>";
  }
  echo "</table>";
?>
Copy after login

[Run results]

Related recommendations:

PHP recursion and loop to implement string flipping

PHP to implement circular linked list function

for in PHP How to nest loops

##

The above is the detailed content of PHP double-layer loop implements ninety-nine multiplication tables. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!