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

From: Date: Thu, 27 Oct 2016 11:38:42 +0000
Subject: Req #73400 [NEW]: requesting syntactic sugar for T_COALESCE (??)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205037@lists.php.net to get a copy of this message
From:             raffaellobertini at gmail dot com
Operating system: CentOS
PHP version:      7.1.0RC4
Package:          Compile Failure
Bug Type:         Feature/Change Request
Bug description:requesting syntactic sugar for T_COALESCE (??)

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 bug report at https://bugs.php.net/bug.php?id=73400&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=73400&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=73400&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=73400&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=73400&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=73400&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=73400&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=73400&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=73400&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=73400&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=73400&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=73400&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=73400&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=73400&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73400&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=73400&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=73400&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=73400&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73400&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=73400&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=73400&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#205037) next »