On 16 Sep 2014, at 19:38, Adam Harvey <ahar...@php.net> wrote:

> On 16 September 2014 11:34, Andrea Faulds <a...@ajf.me> wrote:
>> By popular demand, I’ve changed the RFC to instead propose a ?? operator, 
>> after Nikita Popov generously donated a working ?? patch. In doing so, the 
>> RFC is renamed “Null Coalesce Operator”.
>> 
>> Please read it: https://wiki.php.net/rfc/isset_ternary
> 
> Love it! Kudos to you and Nikita.
> 
> Is it possible to chain ?? operators; ie $value = $foo ?? $bar ?? 'default’?

Yep:

$ sapi/cli/php -r '$x = NULL; $y = NULL; $z = 3; var_dump($x ?? $y ?? $z);'
int(3)

$ sapi/cli/php -r '$x = ["yarr" => "meaningful_value"]; var_dump($x["aharr"] ?? 
$x["waharr"] ?? $x["yarr"]);'
string(16) "meaningful_value"
--
Andrea Faulds
http://ajf.me/





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

Reply via email to