Skip to content

Instantly share code, notes, and snippets.

@vishwac09
Created February 17, 2022 11:58
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 vishwac09/b6e0eb53c8446e68c4b003336c05f38f to your computer and use it in GitHub Desktop.
Save vishwac09/b6e0eb53c8446e68c4b003336c05f38f to your computer and use it in GitHub Desktop.
CodingStandard-MatchExpression
<?php
$food = 'cake';
$return_value = match ($food) {
'apple' => 'This food is an apple',
'bar' => 'This food is a bar',
'cake' => 'This food is a cake',
};
var_dump($return_value);
// string(19) "This food is a cake"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment