Req #74028 [Opn->Sus]: new combined operators ?= and ??=

From: Date: Thu, 02 Feb 2017 18:25:06 +0000
Subject: Req #74028 [Opn->Sus]: new combined operators ?= and ??=
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207135@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74028&edit=1 ID: 74028 Updated by: cmb@php.net Reported by: from_php at puggan dot se Summary: new combined operators ?= and ??= -Status: Open +Status: Suspended Type: Feature/Change Request Package: *General Issues PHP Version: Irrelevant Block user comment: N Private report: N New Comment: There is already an RFC regarding ??=[1] which has been accepted. It is supposed to be implemented for PHP 7.2. Introducing ?= would also require an RFC, so feel free to start the RFC process[2}. I'm suspending this ticket for the time being. [1] <https://wiki.php.net/rfc/null_coalesce_equal_operator> [2] <https://wiki.php.net/rfc/howto> Previous Comments: ------------------------------------------------------------------------ [2017-02-01 15:14:10] from_php at puggan dot se Description: ------------ Could you make 2 new combined operators: $a ?= 4 => $a = $a ?: 4 AND $a ??= 4 => $a = $a ?? 4 Test script: --------------- <?php function ofstr($a = NULL, $b = NULL) { $a ?= 1; $b ?= 100; return "$a of $b"; } print_r( array( ofstr(2, 5), ofstr(60), ofstr(FALSE, 5) ) ); Expected result: ---------------- Array ( [0] => 2 of 5 [1] => 60 of 100 [2] => 1 of 5 ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74028&edit=1

« previous php.bugs (#207135) next »