Zend
200-710 · Question #224
Given the following PHP function: `` function doSomething(?string $s) { // ... } `` Which of the following values for the $s parameter do NOT yield a type error when calling the doSomething()…
The correct answer is B. `""` (empty string). See the full explanation below for the reasoning.
Functions
Question
Given the following PHP function:
function doSomething(?string $s) {
// ...
}
Which of the following values for the $s parameter do NOT yield a type error when calling the doSomething() function?Options
- A
null - B
""(empty string) - C
0 - DAll of the above
How the community answered
(45 responses)- A16% (7)
- B71% (32)
- C4% (2)
- D9% (4)
Topics
#nullable types#type hints#type coercion#function parameters
Community Discussion
No community discussion yet for this question.