I want to use the null coalesce operator like this
$response['shares']->getField('count') ?? 0
What this should do is to get the share count or if its not set get 0. The problem I'm having now is, that sometimes the array index shares
does not exist so I'm getting ErrorException: Undefined index: shares
. I know that I could do it like this
isset($response['shares']) ? $response['shares']->getField('count') : 0
but is there a way to do that with the null coalesce operator directly without checking every index for its existence?