![]() If condition evaluates to a value that doesn't match any of the case: labels, and the default: label is not present, then none of the statements in the switch body is executed. ![]() If condition evaluates to a value that doesn't match any of the case: labels, and the default: label is present, control is transferred to the statement labeled with the default: label. If condition evaluates to a value that is equal to the value of one of constant-expressions, then control is transferred to the statement that is labeled with that constant-expression. At most one default: label may be present (although nested switch statements may use their own default: labels or have case: labels whose constants are identical to the ones used in the enclosing switch). ![]() The body of a switch statement may have an arbitrary number of case: labels, as long as the values of all constant-expressions are unique (after conversions/promotions). case: and default: labels are permitted in statement and break statement has special meaning.Īttrâ (optional) case constant-expression : statementĪ constant expression of the same type as the type of condition after conversions and integral promotions If the (possibly converted) type is subject to integral promotions, condition is converted to the promoted type.Īny statement (typically a compound statement). ![]() The switch case in PHP can also include a default. In PHP, we use a switch statement for the execution of one statement by specifying multiple conditions. PHP also supports the alternative syntax for the switch statement as follows:
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |