on-internet
← Community

Is there a "nullsafe operator" in PHP?

Stack Overflow ·

Is there any way to write the following statement using some kind of safe navigation operator? echo $data->getMyObject() != null ? $data->getMyObject()->getName() : ''; So that it looks like this: echo $data->getMyObject()?->getName();

Comments

Sign in or sign up to comment and upvote.

No comments yet.