Ben Schmidt wrote: >>> $var = $arr['key'] ?? : 'empty'; > > Also note this is possible with the recent proposal Hannes and I were > discussing. It simply looks like > > $var = $arr?['key'] ?: 'empty'; > > The ?[ avoids notices and the ?: works as it always has. > > Ben.
If it was going to be ?[, I'd much prefer $arr['key'?]. It was proposed as $arr[?'key'] instead to avoid a backtracking (would that really be noticeable? I'd prefer readibility), but ?[ would have the same problem. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php