PHP Switch Case Statement Syntax and Example

This statement is used if one needs to select one from multiple options.

PHP Switch Case Syntax:

  1. PHP switch case is used to select one among multiple options.
  2. inside switch we can use expression or  value
  3. inside switch there can be multiple case statement with different case value.
  4. case value must be constant.
  5. break is optional in php switch case
  6. Default is optional in php switch
  7. If any case does not match then default is executed.

Example: PHP Switch case statement

I booked Swift