Answers for "match expression php"

PHP
0

php match

<?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);
?>
Posted by: Guest on November-03-2021
0

php 8 Match Expression

echo match (8.0) {
  '8.0' => "Oh no!",
  8.0 => "This is what I expected",
};
//> This is what I expected
// TurkoSoft
Posted by: Guest on October-18-2021

Code answers related to "match expression php"

Browse Popular Code Answers by Language