Switch case

Eyl 20- Switch case yapısı, çok durumlu dallanma ifadelerinde if-else blokları yerine tercihen kullanılırlar. Switch-case ile yapılabilecek tüm işlemler . Unlike if-then and if-then-else statements, the switch statement can have a number of possible execution paths.

A switch works with the byte , short , char , and . This is how it works: The switch expression is evaluated once. The value of the expression is compared with the values of each case. The switch statement is used to perform different actions based on different.

Use break to prevent the code from running into the next case automatically. Yalnızca switch ifadesiyle birlikte verilen değer ile uyuşan case deyimi bulunduğunda PHP ilgili deyimleri çalıştırmaya başlar. If you are checking on the value of a single variable in if.

The switch statement is often faster than nested if. Multi-case – single operation bölümüne geç – This is an example of a single operation sequential switch statement, where four different values perform .