rfc:short_list_syntax
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:short_list_syntax [2016/04/06 13:56] – Push date forward to today, as that's when it's gone under discussion ajf | rfc:short_list_syntax [2016/05/08 18:28] – close vote ajf | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: Square bracket syntax for array destructuring assignment ====== | ====== PHP RFC: Square bracket syntax for array destructuring assignment ====== | ||
* Version: 1.0 | * Version: 1.0 | ||
- | * Date: 2016-04-06 | + | * Date: 2016-04-07 |
* Authors: Andrea Faulds < | * Authors: Andrea Faulds < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 77: | Line 77: | ||
<?php | <?php | ||
- | // These two statements | + | // The two lines in each of the following pairs are equivalent |
list($a, $b, $c) = array(1, 2, 3); | list($a, $b, $c) = array(1, 2, 3); | ||
[$a, $b, $c] = [1, 2, 3]; | [$a, $b, $c] = [1, 2, 3]; | ||
- | // These two statements are also equivalent: | ||
list(" | list(" | ||
[" | [" | ||
+ | |||
+ | list($a, $b) = array($b, $a); | ||
+ | [$a, $b] = [$b, $a]; | ||
</ | </ | ||
Line 118: | Line 121: | ||
// This is also not allowed: | // This is also not allowed: | ||
[list($a, $b), list($c, $d)] = [[1, 2], [3, 4]]; | [list($a, $b), list($c, $d)] = [[1, 2], [3, 4]]; | ||
+ | |||
+ | // This, however, is allowed: | ||
+ | [[$a, $b], [$c, $d]] = [[1, 2], [3, 4]]; | ||
</ | </ | ||
+ | |||
+ | Aside from this restriction, | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 146: | Line 154: | ||
We may wish to introduce destructuring assignment syntax for objects in future. | We may wish to introduce destructuring assignment syntax for objects in future. | ||
- | ===== Proposed Voting Choices | + | ===== Vote ===== |
Because this proposal affects the language syntax (and also therefore the specification), | Because this proposal affects the language syntax (and also therefore the specification), | ||
The vote will be a simple Yes/No vote on whether or not to accept the RFC for PHP 7.1 and merge the patch into master. | The vote will be a simple Yes/No vote on whether or not to accept the RFC for PHP 7.1 and merge the patch into master. | ||
+ | |||
+ | Voting started on 2016-04-27 and ended on 2016-05-08. | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== |
rfc/short_list_syntax.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1