Created
February 17, 2022 11:58
-
-
Save vishwac09/b6e0eb53c8446e68c4b003336c05f38f to your computer and use it in GitHub Desktop.
CodingStandard-MatchExpression
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 | |
$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