mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-15 10:26:55 +01:00
35 lines
656 B
Plaintext
35 lines
656 B
Plaintext
|
switch/case/default
|
||
|
-----
|
||
|
<?php
|
||
|
|
||
|
switch ($expr) {
|
||
|
case 0:
|
||
|
echo 'First case, with a break';
|
||
|
break;
|
||
|
case 1:
|
||
|
echo 'Second case, which falls through';
|
||
|
case 2:
|
||
|
case 3:
|
||
|
case 4:
|
||
|
echo 'Third case, return instead of break';
|
||
|
return;
|
||
|
default:
|
||
|
echo 'Default case';
|
||
|
break;
|
||
|
}
|
||
|
-----
|
||
|
switch ($expr) {
|
||
|
case 0:
|
||
|
echo 'First case, with a break';
|
||
|
break;
|
||
|
case 1:
|
||
|
echo 'Second case, which falls through';
|
||
|
case 2:
|
||
|
case 3:
|
||
|
case 4:
|
||
|
echo 'Third case, return instead of break';
|
||
|
return;
|
||
|
default:
|
||
|
echo 'Default case';
|
||
|
break;
|
||
|
}
|