Req #73400 [Com]: requesting syntactic sugar for T_COALESCE (??)

From: Date: Thu, 27 Oct 2016 11:41:00 +0000
Subject: Req #73400 [Com]: requesting syntactic sugar for T_COALESCE (??)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205038@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73400&edit=1

 ID:                 73400
 Comment by:         raffaellobertini at gmail dot com
 Reported by:        raffaellobertini at gmail dot com
 Summary:            requesting syntactic sugar for T_COALESCE (??)
 Status:             Open
 Type:               Feature/Change Request
 Package:            Compile Failure
 Operating System:   CentOS
 PHP Version:        7.1.0RC4
 Block user comment: N
 Private report:     N

 New Comment:

i forgot to add:

$a = $a + $b;

$a += $b;

you got what i mean..


Previous Comments:
------------------------------------------------------------------------
[2016-10-27 11:38:38] raffaellobertini at gmail dot com

Description:
------------
it often happen doing something similar to this assignment pattern:

$something = $something ?? ....whatever... ;

as a syntactic sugar it will be nice to have:

$something ??= ....whatever;

that will be interpreted as the original first line. Just simply syntactic sugar.

like the case of the operator:

$a = $a + 1;
$a++;





Expected result:
----------------
if $something is set $something will be no operation or assigned itself, otherwise the RH operand
will be assigned to $something.

Actual result:
--------------
PHP Parse error:  syntax error, unexpected ?? (T_COALESCE) in php shell code on line 1


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=73400&edit=1


Thread (3 messages)

« previous php.bugs (#205038) next »