第八行和第十四行不输入break,仍然可以得到20,所以这两行不输入可以吗?
<?php //A例子 $num = 2; $sum = 10; switch($num){ case 1: $sum = $sum + 10; case 2: $sum = $sum + 10; break; case 3: $sum = $sum + 10; default: $sum = $sum + 10; } echo "A例子的值是:".$sum."<br />";
<?php //A例子 $num = 2; $sum = 10; switch($num){ case 1: $sum = $sum + 10; case 2: $sum = $sum + 10; break; case 3: $sum = $sum + 10; default: $sum = $sum + 10; } echo "A例子的值是:".$sum."<br />";
2015-09-21
举报