Complete the code to declare the parameter type as integer.
<?php function addOne([1] $num) { return $num + 1; } ?>
The parameter type int declares that the function expects an integer.
Complete the code to declare the parameter type as string.
<?php function greet([1] $name) { return "Hello, " . $name; } ?>
The parameter type string declares that the function expects a text value.
Fix the error in the function parameter type declaration.
<?php function multiply([1] $value1, int $value2) { return $value1 * $value2; } ?>
The correct type declaration for integers in PHP is int, not 'integer' or 'number'.
Fill both blanks to declare parameter types for a function that takes a float and a boolean.
<?php function checkValues([1] $score, [2] $passed) { if ($passed) { return $score; } return 0; } ?>
The first parameter is a floating-point number, so use float. The second is a true/false value, so use bool.
Fill all three blanks to declare parameter types for a function that takes a string, an integer, and a boolean.
<?php function processData([1] $name, [2] $age, [3] $isMember) { if ($isMember) { return "Welcome " . $name . ", age " . $age; } return "Guest"; } ?>
The parameters are a text name (string), an age number (int), and a true/false membership status (bool).