Last active
June 6, 2019 14:18
-
-
Save flaviors200/02b32be2e0b8734b50d81b1cf7fc142b to your computer and use it in GitHub Desktop.
Conditional statement: switch case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$day = 'sabato'; | |
switch ($day) { | |
case 'lunedì': | |
echo "Oggi è lunedì"; | |
break; | |
case 'martedì': | |
echo "Oggi è martedì"; | |
break; | |
case 'mercoledì': | |
echo "Oggi è mercoledì"; | |
break; | |
case 'giovedì': | |
echo "Oggi è giovedì"; | |
break; | |
case 'venerdì': | |
echo "Oggi è venerdì"; | |
break; | |
case 'sabato': | |
echo "Oggi è sabato"; | |
break; | |
case 'domenica': | |
echo "Oggi è domenica"; | |
break; | |
default: | |
echo "Impossibile stabilire che giorno è oggi!"; | |
} | |
// Output: Oggi è sabato |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment