Home > Backend Development > PHP Tutorial > 用二维数组写出九九乘法表解决方案

用二维数组写出九九乘法表解决方案

WBOY
Release: 2016-06-13 10:09:05
Original
2727 people have browsed it

用二维数组写出九九乘法表
//用二维数组写出九九乘法表
$array = array();
for($i=1; $i{
for($j = 1; $j {
$array[$j . '*' . $i] = $i * $j;
}
}
echo '

';  <br>print_r($array);<br><br>?><br><br>其中$array[$j . '*' . $i] = $i * $j;这句能不能换成用二维数组的方式输出?谢谢了<br><br><font color="#e78608">------解决方案--------------------</font><br>$array[$j-1][$i-1] = $i * $j<br>这样?<br><font color="#e78608">------解决方案--------------------</font><br>作业又来了...上次已经有个学生问过了。<br><font color="#e78608">------解决方案--------------------</font><br>
Copy after login
PHP code
for($a =1;$a";}<br><font color="#e78608">------解决方案--------------------</font><br>
Copy after login
PHP code
//用二维数组写出九九乘法表$array = array();for($i=1; $i';  print_r($array);<br><font color="#e78608">------解决方案--------------------</font><br>我四楼的代码就是你想要的效果  <br>1*1=1<br>1*2=2 2*2=4<br><br>1*3=3 2*3=6 3*3=9<br><br>1*4=4 2*4=8 3*4=12 4*4=16<br><br>1*5=5 2*5=10 3*5=15 4*5=20 5*5=25<br><br>1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36<br><br>1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49<br><br>1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64<br><br>1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81<br><font color="#e78608">------解决方案--------------------</font><br>1个月之后来看结果<div class="clear">
                 
              
              
        
            </div>
Copy after login
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