switch statement in PHP
It is possible to simplify logic of the PHP code with switch statement rather then multiple conditions in an if statement. Conditions in an if statement may become cumbersome and the logic of that if statement maybe unclear. switch PHP statement simplifies that logic. Even so it is possible to have multiple conditions in switch statement that will evaluate to True, only the first one section of the code that follows the condition that evaluated to True will be executed. It is possible to have default statement in a switch statement. Code that follows default statement will be executed in a case when all other conditions in a switch statement evaluate to false.
Comments
Post a Comment