$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.




--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to