Bird
0
0

Which keyword is used to execute code when none of the case labels match in a PHP switch statement?

easy📝 Conceptual Q2 of 15
PHP - Conditional Statements
Which keyword is used to execute code when none of the case labels match in a PHP switch statement?
Aelse
Bfallback
Cotherwise
Ddefault
Step-by-Step Solution
Solution:
  1. Step 1: Recall switch statement structure

    PHP switch statements use case labels and an optional default label.
  2. Step 2: Identify the keyword for unmatched cases

    The default keyword runs code if no case matches.
  3. Final Answer:

    default -> Option D
  4. Quick Check:

    Keyword for unmatched case = default [OK]
Quick Trick: Use default for unmatched cases in switch [OK]
Common Mistakes:
  • Using else instead of default
  • Trying to use fallback or otherwise keywords
  • Omitting default and expecting automatic fallback

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes