If you have say, 200 conditions to check. Then you will have to go
through a nasty long block of If/ElseIf/ElseIf/ElseIf/... statements.
PHP Switch
statement could check all 200 conditions at once,
In this example the single variable will be $destination and the cases will be: Las Vegas, Amsterdam, Egypt, Tokyo, and the Caribbean Islands.
The value of $destination was Tokyo, so PHP search for a case with the value of "Tokyo".
Php found it and proceeded to execute the code that existed within that segment.
Noticed how each case contains a break; at the end of its code area. This break prevents the other cases from being executed.
Note: With no break statements then all the cases that follow Tokyo will be executed too.
If there are no matched case the switch statement has the default case as a safety net.
A default case should be included in all your switch statements.
See the examle below.
Note
For more detail please see
Php Manual at http://www.php.net