match
Match keyword with the values. This is a new feature in PHP8.
$language_code = "en";
$language = match ($language_code){
'en' => 'English',
'es' => 'Spanish',
'fr' => 'French'
}
echo $language; // returns 'English'
copy