Blogger Information
Blog 33
fans 0
comment 2
visits 41948
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP 循环嵌套生成九九乘法表
hanyufeng的博客
Original
937 people have browsed it

说明:循环嵌套生成九九乘法表

运行效果:

L23-2.png

示例源码:

<?php
//九九乘法表(嵌套循环)
echo '<hr>';
echo '<table border="1" cellspacing="0" cellpadding="5" width="900">';
echo '<caption>九九乘法表</caption>';
for($i= 1;$i <=9; $i++)// i从1到9循环,外层循环
{
    echo '<tr>';
    for($j=1; $j<=$i; $j++) //从1开始循环到i的当前值,内层循环
    {
        echo '<td>';
        echo "$i × $j = ".$i*$j;
        echo '</td>';
    }
    echo '</tr>';

}
echo '</table>';


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!