Re:PHP in 2020
by lemcoe9 on Wednesday January 22, 2020 @07:16AM
(#22116856)
I do not understand, both of the expressions on the left-hand side are NULL, which looks like ?? is doing the same thing in both examples. A non-existent array key and a non-existent property on an object are logistically identical.
$value = $object->property ?? 'fallback if null';
$value = $array['foo'] ?? "fallback if key doesn't exists";