Req #73400 [Opn->Csd]: requesting syntactic sugar for T_COALESCE (??)

From: Date: Thu, 27 Oct 2016 12:41:11 +0000
Subject: Req #73400 [Opn->Csd]: requesting syntactic sugar for T_COALESCE (??)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205039@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 Updated by: cmb@php.net Reported by: raffaellobertini at gmail dot com Summary: requesting syntactic sugar for T_COALESCE (??) -Status: Open +Status: Closed Type: Feature/Change Request -Package: Compile Failure +Package: Scripting Engine problem Operating System: CentOS PHP Version: 7.1.0RC4 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: It has already been decided to add this feature[1], but for time reasons we did not yet manage to implement it. It is supposed that the null coalesce equal operator will be available as of PHP 7.2. I'm therefore closing this ticket. [1] <https://wiki.php.net/rfc/null_coalesce_equal_operator> Previous Comments: ------------------------------------------------------------------------ [2016-10-27 11:41:00] raffaellobertini at gmail dot com i forgot to add: $a = $a + $b; $a += $b; you got what i mean.. ------------------------------------------------------------------------ [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

« previous php.bugs (#205039) next »