Complete the code to declare a nullable integer parameter in the function.
<?php function example([1] $num) { return $num; } ?>
The ?int syntax declares that the parameter can be an integer or null.
Complete the function return type to allow returning an integer or null.
<?php function getValue(): [1] { return null; } ?>
The return type ?int means the function can return an integer or null.
Fix the error in the function parameter type to accept null or string.
<?php function greet([1] $name) { if ($name === null) { return 'Hello, Guest!'; } return "Hello, $name!"; } ?>
Using ?string allows the parameter to be a string or null.
Fill both blanks to declare a function with a nullable float parameter and nullable float return type.
<?php function calculate([1] $value): [2] { if ($value === null) { return null; } return $value * 2; } ?>
Both the parameter and return type use ?float to allow float or null.
Fill all three blanks to create a function with a nullable string parameter, nullable int parameter, and nullable string return type.
<?php function process([1] $text, [2] $count): [3] { if ($text === null || $count === null) { return null; } return str_repeat($text, $count); } ?>
The parameters and return type use nullable types: ?string and ?int.