Use default to handle unspecified cases in a switch block:
<?php
$a = 4;
switch($a) {
case 1: echo "One"; break;
case 2: echo "Two"; break;
case 3: echo "Three"; break;
default: echo "Many"; break;
}
?>
Try it Yourself »
The default
keyword is used in a switch
block to specify which code to run when none of the case
statements were matched by the expression.
The switch
keyword.
Read more about the switch conditional in our PHP switch Statement Tutorial.
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!