Home  >  Article  >  Backend Development  >  How to implement 99 multiplication table in php

How to implement 99 multiplication table in php

藏色散人
藏色散人Original
2020-08-21 09:47:109585browse

php method to implement 99 multiplication table: first set the i-th row to have i column; then make each record equal to the current column times the current row; finally pass "echo "{$j}*{$i }=".($j*$i).' ';" The method outputs the 99 multiplication table.

How to implement 99 multiplication table in php

Recommended: "PHP Video Tutorial"

Write a multiplication table using PHP:

Rules:

1. The i-th row has i column.

2. Each record is equal to the current column times the current row.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>九九乘法表</title>
</head>
<body>
    <?php
    for($i=1;$i<10;$i++){
 
    for($j=1;$j<=$i;$j++){
    echo "{$j}*{$i}=".($j*$i).&#39;   &#39;;
}
echo &#39;<br>&#39;;
}
    ?>
</body>
</html>

Effect display:

How to implement 99 multiplication table in php

Style and table styles can be added by yourself later.

The above is the detailed content of How to implement 99 multiplication table in php. 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