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?
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?
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.
'B' answer is wrong, D - is correct answer