The title of the program first title for the second runner-up third place for runners-up four after all thanks to the participation Award;
$a = 1;
if ($a = = 1) {
echo ' champion ';
}else if ($a = = 2) {
echo ' runner ';
}else if ($a ==3) {
Echo ' third place ';
}else if ($a >3) {
Echo ' Thank you for participating ';
}
Break is not executed as long as the program is true after the program
Default defaults are written by default in addition to the criteria specified above
$a = 2;
Switch ($a) {
Case 1:
echo ' champion ';
Breeak;
Case 2:
echo ' runner ';
Break
Case 3:
Echo ' third place ';
Break
Default
Echo ' Thank you for participating ';
}
Conditions change from 3 to 5 for the third runner-up can be written like this
Switch ($a) {
Case 1:
echo ' champion ';
Breeak;
Case 2:
echo ' runner ';
Break
Case 3:
Case 4:
Case 5:
Echo ' third place ';
Break
Default
Echo ' Thank you for participating ';
}
PHP Basics: Switch CASS control structure instead of if