Why Not “Switch” from If/Else? Are you tired of writing if/elseif/elseif/…/else statements? You’re not alone. There is a more elegant way to write such large statements: the PHP switch statement. Let’s take a look at the anatomy of the switch statement.   switch ( $arg ) { case “value_1”: expression if matched value_1 break; // terminate case “value_2”: expression if matched value_2 break; // terminate … default: execute if no cases matched }   The switch statement accepts an argument. It has a series of “cases” that could potentially match the value of the argument. If it matches, the statements inside of that particular case are executed.