Is there a “nullsafe operator” in PHP?
From PHP 8, you are able to use the null safe operator which combined with the null coalescing operator allows you to write code like: echo $data->getMyObject()?->getName() ?? ”; By using ?-> instead of -> the chain of operators is terminated and the result will be null. The operators that “look inside an object” are … Read more