rfc:spread_operator_for_array
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:spread_operator_for_array [2019/04/05 14:10] – more example jhdxr | rfc:spread_operator_for_array [2019/05/13 12:45] (current) – Implemented nikic | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2018-10-13 | * Date: 2018-10-13 | ||
* Author: CHU Zhaowei, jhdxr@php.net | * Author: CHU Zhaowei, jhdxr@php.net | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 84: | Line 84: | ||
===== Q & A ===== | ===== Q & A ===== | ||
==== Advantages over array_merge ==== | ==== Advantages over array_merge ==== | ||
- | - Spread operator should have a better performance than '' | + | - Spread operator should have a better performance than '' |
- | - '' | + | - '' |
- | <code php> | + | <PHP> |
// Before | // Before | ||
array_merge(iterator_to_array($iter1), | array_merge(iterator_to_array($iter1), | ||
- | // Or to generalise | + | // Or to generalize |
- | array_merge( is_array($iter1) ? $iter1 : iterator_to_array($iter1), | + | array_merge( |
- | is_array($iter2) ? $iter2 : iterator_to_array($iter2) ) | + | |
+ | is_array($iter2) ? $iter2 : iterator_to_array($iter2) | ||
+ | ) | ||
// After (handles both cases) | // After (handles both cases) | ||
Line 98: | Line 100: | ||
//Thanks Rowan for providing this example | //Thanks Rowan for providing this example | ||
- | </code> | + | </PHP> |
==== ... should be preserved for other use (e.g. map concat) ==== | ==== ... should be preserved for other use (e.g. map concat) ==== | ||
Line 108: | Line 110: | ||
===== RFC Impact ===== | ===== RFC Impact ===== | ||
==== To Opcache ==== | ==== To Opcache ==== | ||
- | I'm not sure if this RFC will have any impact on Opcache. I'll check it after I finish | + | Some changes in opcache to support |
+ | ===== Vote ===== | ||
+ | Voting started 2019-04-22 and ends 2019-05-06. A 2/3 majority is required. | ||
- | ===== Proposed Voting Choices ===== | + | <doodle title=" |
- | As this is a language change, a 2/3 majority is required. | + | * Yes |
+ | * No | ||
+ | </doodle> | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== |
rfc/spread_operator_for_array.1554473404.txt.gz · Last modified: 2019/04/05 14:10 by jhdxr