Skip to main content

PHP Switch Statement

Switch Statement is the same as If…Else Statements except that it is easier to use if you have multiple conditions.
Switch Syntax switch (condition) { case condition1: statement to be executed if n=condition1; break; case condition 2: statement to be executed if n=condition2; break; default: statement to be executed if n is different from both condition 1 and condition 2; } condition is a variable expression that is evaluated once. If the first condition is true then the succeeding condition will not be executed anymore, else it will continue until it finds the condition that is equals to true or execute the default statement if no matching condition.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.