200-710 Exam QuestionsBrowse all questions from this exam

200-710 Exam - Question 34


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?

Show Answer
Correct Answer: B

The PHP function doSomething(?string $s) indicates that the parameter $s can either be a string or null. Among the options provided, 'null' is the only one that explicitly represents a null value in PHP, and it will not yield a type error when passed to the function. Thus, null is the correct answer.

Discussion

1 comment
Sign in to comment
linkmasterOption: D
Sep 26, 2021

'B' answer is wrong, D - is correct answer