PHP - Functions
Which of the following is the correct nullable type syntax to declare a function parameter that accepts a nullable string in PHP?
? before the type, like ?string.?string correctly. function greet(string|null $name) {} uses union type syntax which is valid in PHP 8+, but the question asks for nullable syntax specifically. Options C and D are invalid syntax.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions