php 循环应用
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<table align="center" width="80%" border="1">
<caption><h2>使用while循环嵌套输出表格</h2></caption>
<?php
$out=0;
while($out<10){
$aa= $out%2==0 ? "#ffffff" : "#dddddd";
echo "<tr bgcolor= $aa>";
//echo "<tr bgcolor=".$aa.">";
$in=0;
while($in<10){
echo "<td>".($out*10+$in)."</td>";
$in++;
}
echo "</tr>";
$out++;
}
?>
</table>
</body>
</html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<table align="center" width="80%" border="1">
<caption><h2>使用while循环嵌套输出表格</h2></caption>
<?php
$out=0;
while($out<10){
$aa= $out%2==0 ? "#ffffff" : "#dddddd";
echo "<tr bgcolor= $aa>";
//echo "<tr bgcolor=".$aa.">";
$in=0;
while($in<10){
echo "<td>".($out*10+$in)."</td>";
$in++;
}
echo "</tr>";
$out++;
}
?>
</table>
</body>
</html>
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇: php二维数组的输出 for循环结合foreach
