Home > Backend Development > PHP Tutorial > PHP Daily 3-21 Design a multiplication table

PHP Daily 3-21 Design a multiplication table

WBOY
Release: 2016-07-29 08:57:19
Original
1366 people have browsed it

php日常3-21 设计一个九九乘法表
The difference from the previous table is that there are more restrictions on the number of columns in each row
That is, the first row is one column, the second row is two columns, and so on
So

<code><span><<span>table</span><span>border</span>=<span>"1"</span><span>align</span>=<span>"center"</span><span>width</span>=<span>"800"</span>></span><span><<span>caption</span>></span><span><<span>h1</span>></span>九九乘法表<span></<span>h1</span>></span><span></<span>caption</span>></span><span><span><?php</span><span>for</span> (<span>$i</span> = <span>1</span>; <span>$i</span> < <span>10</span>; <span>$i</span>++) {
                <span>if</span>(<span>$i</span>%<span>2</span>==<span>0</span>){
                    <span>$bgc</span>=<span>"#ccc"</span>;
                }
                <span>else</span>{
                    <span>$bgc</span>=<span>"red"</span>;
                }
                <span>?></span></span><span><<span>tr</span><span>bgcolor</span>=<span>"<?php echo "</span><span>$bgc"</span> ?></span>">
                    <span><span><?php</span><span>for</span> (<span>$a</span> = <span>1</span>; <span>$a</span> < <span>$i</span>+<span>1</span>; <span>$a</span>++) { <span>?></span></span><span><<span>td</span>></span><span><span><?php</span><span>echo</span><span>"$a*$i="</span>; 
                                  <span>echo</span><span>$i</span>*<span>$a</span><span>?></span></span><span></<span>td</span>></span><span><span><?php</span> }<span>?></span></span><span></<span>tr</span>></span><span><span><?php</span> }<span>?></span></span><span></<span>table</span>></span></code>
Copy after login
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces PHP daily 3-21 design of a multiplication table, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

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