I want to get the value of a deeply nested property.
e.g.
$data->person->name->last_name;
The problem is I am not sure if person
or name
is declared. I also don't want to use nested if
statements. If
statements won't look good for deeply nested properties.
Is there a null-conditional operator in PHP?
Solved
There is no need for a null-conditional
operator since a null-coalescence
operator does the job.