Skip to content

Instantly share code, notes, and snippets.

@lechidung
Last active November 29, 2020 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lechidung/319e47783c84f365ef595199870166aa to your computer and use it in GitHub Desktop.
Save lechidung/319e47783c84f365ef595199870166aa to your computer and use it in GitHub Desktop.
PHP 8
/*** 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