首页 > 编程 > PHP > 正文

PHP学习——流程控制结构

2019-11-11 02:22:48
字体:
来源:转载
供稿:网友

switch语句中case后可以是整型,也可以是字符串,相等是==不是必须===。

<html> <head> <title>使用while循环嵌套输出表格</title> </head> <body> <table align="center" border="1" width=600> <caption>使用while循环嵌套输出表格</caption> <?php $out=0; while($out<10) { $bgcolor=$out%2==0?"FFFFFF":"DDDDDD"; echo "<tr bgcolor=".$bgcolor.">"; $in=0; while($in<10) { echo "<td>".($out*10+$in)."</td>"; $in++; } echo "</tr>"; $out++; } ?> </table> </body></html>

在PHP中goto语句只能在同一个文件和作用域中跳转,也就是说无法跳出一个函数或类方法,也无法跳入另一个函数,更无法跳入任何循环或者switch结构中


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表