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.
In questa pagina del sito puoi guardare il video online 21) switch case in PHP | PHP Switch Statement Tutorial della durata di ore minuti seconda in buona qualità , che l'utente ha caricato programming_with_vinay 06 luglio 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 15 volte e gli è piaciuto 0 spettatori. Buona visione!