Intermediate
PHP
Q52 / 100
What does PHP's null safe operator ?-> do?
Correct! Well done.
Incorrect.
The correct answer is B) Chains method calls safely, returning null if any part of the chain is null instead of throwing an error
B
Correct Answer
Chains method calls safely, returning null if any part of the chain is null instead of throwing an error
Explanation
$user?->getAddress()?->getCity() returns null if $user or getAddress() is null, avoiding multiple isset() checks. Added in PHP 8.
Progress
52/100