PHP Switch Statement – PHP Tutorial – 13



What is Switch case in PHP ?
The Switch case statements is used to check condition weather is true or not. Switch case statements also called conditional statements. This statement is used for execute one block code from multiple code blocks. in this, we have single expression, means single variable value can use. Then we declare multiple case and there different – different code blocks. After that declaring case statement, the expression or variable value will check each case condition, if ture, then code block execute.

what is break statement ?
Break; statement is used in every, because it is used to prevent the code from running into the next case automatically.

what is default statement ?
default statement is used if no match is found. if case are not matched then default statement execute.

Thanks you

source