diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-01-15 17:04:24 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-01-22 11:12:04 +0100 |
commit | a50198d0fef652ca052cda642d6e98a9101eb73f (patch) | |
tree | 8bd51746c7418ae0826d527eb57fbebdb67b05d7 /Zend/zend_ast.c | |
parent | 50ddff94b9989342e66678c311b3abf4e7d5a074 (diff) | |
download | php-git-a50198d0fef652ca052cda642d6e98a9101eb73f.tar.gz |
Implement ??= operator
RFC: https://wiki.php.net/rfc/null_coalesce_equal_operator
$a ??= $b is $a ?? ($a = $b), with the difference that $a is only
evaluated once, to the degree that this is possible. In particular
in $a[foo()] ?? $b function foo() is only ever called once.
However, the variable access themselves will be reevaluated.
Diffstat (limited to 'Zend/zend_ast.c')
-rw-r--r-- | Zend/zend_ast.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 8ddf8ea9ab..a679fcf690 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -1672,6 +1672,7 @@ simple_list: EMPTY_SWITCH_DEFAULT_CASE(); } break; + case ZEND_AST_ASSIGN_COALESCE: BINARY_OP(" \?\?= ", 90, 91, 90); case ZEND_AST_BINARY_OP: switch (ast->attr) { case ZEND_ADD: BINARY_OP(" + ", 200, 200, 201); |