PHP switch statement

PHP switch statement is a better alternative than a large series of if-else-if statements. It can switch in different part of the code based on condition. Here is the general form of a PHP switch statement. 
case value1
executed statement;
case value2
executed statement;
// default statement

In the PHP switch statement duplicate case values are not allowed. The expression value checks every case iteratively if a match is found then the following case statement is executed. If none of the cases does not matches the value of the expression, then the default statement is executed.


Popular posts from this blog

How to show only month and year fields in android Date-picker?

How to construct a B+ tree with example

Homebrew uninstall