The switch statement is similar to a series of IF statements on the same expression. In many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to. This is exactly what the switch statement is for.
General rule is use switch whenever the number of conditions is greater than 3 (for readability). if / else if / else is more flexible (hence better), but switch is slightly faster because it just computes the condition once and then checks for the output, while if has to do this every time.
On this page of the site you can watch the video online 21) switch case in PHP | PHP Switch Statement Tutorial with a duration of hours minute second in good quality, which was uploaded by the user programming_with_vinay 06 July 2021, share the link with friends and acquaintances, this video has already been watched 15 times on youtube and it was liked by 0 viewers. Enjoy your viewing!