> On Sep 16, 2014, at 13:46, "Kingsquare.nl - Robin Speekenbrink"
> <[email protected]> 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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php