switch語句中case后可以是整型,也可以是字符串,相等是==不是必須===。
<html> <head> <title>使用while循環(huán)嵌套輸出表格</title> </head> <body> <table align="center" border="1" width=600> <caption>使用while循環(huán)嵌套輸出表格</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中g(shù)oto語句只能在同一個文件和作用域中跳轉(zhuǎn),也就是說無法跳出一個函數(shù)或類方法,也無法跳入另一個函數(shù),更無法跳入任何循環(huán)或者switch結(jié)構(gòu)中
新聞熱點
疑難解答