Last active
November 29, 2020 18:18
-
-
Save lechidung/319e47783c84f365ef595199870166aa to your computer and use it in GitHub Desktop.
PHP 8
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 7 ***/ | |
switch (8.0) { | |
case '8.0': | |
$result = "Oh no!"; | |
break; | |
case 8.0: | |
$result = "This is what I expected"; | |
break; | |
} | |
echo $result; | |
//> Oh no! | |
/*** PHP 8 ***/ | |
echo match (8.0) { | |
'8.0' => "Oh no!", | |
8.0 => "This is what I expected", | |
}; | |
//> This is what I expected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment