2014-09-17 10:58 GMT+02:00 Sara Golemon <p...@golemon.com>:
>
>> On Sep 16, 2014, at 13:46, "Kingsquare.nl - Robin Speekenbrink" 
>> <ro...@kingsquare.nl> wrote:
>>
>> As a userland point of view on this: will this have a shorthand? i.e.
>> what will happen if i leave out the second part?
>>
>> ie.
>> $var = $_GET['test'] ?? ;
>>
>> would that be the same as
>> $var = @$_GET['test'];
>>
>> The RFC isnt clear in this regard (or that the righthand side of the
>> operator _is_ required... maybe it's me ?
>>
> The equivalent of your error suppressed example would be:
> $var = $_GET['test'] ?? null;
>
> I don't think it gains anyone much to have another form just to save four 
> characters (for the default `null`).
>
> Someone mentioned an assignment version which isn't covered in niki's patch 
> but would be a fairly trivial addition.
>
> $var ??= expr;
>
> Which essentially means:
> if (!isset($var)) {
>   $var = expr;
> }
>
> I'd kinda like that for completeness, but will vote for this with or without 
> the assignment version.
>
> -Sara

Sara,

Indeed that's what i meant. I'm afraid that i just wasn't clear the first time.
But would indeed also like to see the ??= in one go. This would make
the operator a direct first-class citizen of the language instead of
halfway there ;)

Thanks again, i'll butt out now ;)

Robin

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

Reply via email to