function read(mixed $key): string { return match ($key) { 1 => 'Integer 1', '1' => 'String 1', true => 'Bool true', [] => 'Empty array', [1] => 'Array [1]', }; } read(1); // "Integer 1" read('1'); // "String 1" read(true); // "Bool true"

switch 랑 다르게 타입체크도 하면서 매칭해줌