PHP - Functions
What will be the output of this PHP code?
function multiply(?int $a, int $b) {
return ($a ?? 1) * $b;
}
echo multiply(null, 5);function multiply(?int $a, int $b) {
return ($a ?? 1) * $b;
}
echo multiply(null, 5);$a ?? 1 evaluates to 1.$a is null, it becomes 1, multiplied by 5 equals 5.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions