function select($n): callable{
switch($n){
case 1: return function($a, $b) {return $a + $b;};
case 2: return function($a, $b) {return $a - $b;};
case 3: return function($a, $b) {return $a * $b;};
}
}
$selection = select(1);
echo $selection(4,5);
function select($a): callable{
match($a){
1 => function($b, $c) { return $b + $c; },
2 => function($b, $c) { return $b - $c; },
3 => function($b, $c) { return $b * $c; },
};
}
$opa = select(1);
echo $opa(2,2);