rfc:destructuring_coalesce
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:destructuring_coalesce [2022/11/03 20:08] – bwoebi | rfc:destructuring_coalesce [2022/11/26 15:07] (current) – updated status. danack | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2022-10-14 | * Date: 2022-10-14 | ||
* Author: Bob Weinand < | * Author: Bob Weinand < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 27: | Line 27: | ||
[[$a, $b] ?? [1, 2]] = $array; // if $array[0] is null or does not exist, $a will be 1 and $b will be 2 | [[$a, $b] ?? [1, 2]] = $array; // if $array[0] is null or does not exist, $a will be 1 and $b will be 2 | ||
</ | </ | ||
+ | |||
+ | Also note that, equivalently to how ''??'' | ||
==== Use cases ==== | ==== Use cases ==== | ||
+ | |||
Exploding an externally provided string, e.g. a key-value pair separated by '' | Exploding an externally provided string, e.g. a key-value pair separated by '' | ||
<PHP> | <PHP> | ||
Line 137: | Line 140: | ||
</ | </ | ||
checking for the existence of '' | checking for the existence of '' | ||
+ | |||
+ | ==== Discussion of syntax ==== | ||
+ | |||
+ | This RFC proposes using ''??'' | ||
+ | |||
+ | Other languages like Javascript have constructs like '' | ||
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
Line 146: | Line 155: | ||
There' | There' | ||
- | ===== Proposed Voting Choices | + | ===== Vote ===== |
- | Add a destructuring coalesce feature as described? | + | A 2/3 majority is required. The vote started 2022-11-07 and ended 2022-11-21. |
- | A 2/3 majority is required. | + | <doodle title=" |
+ | * Yes | ||
+ | * No | ||
+ | </doodle> | ||
===== Implementation ===== | ===== Implementation ===== |
rfc/destructuring_coalesce.1667506110.txt.gz · Last modified: 2022/11/03 20:08 by bwoebi