rfc:php7_foreach
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
rfc:php7_foreach [2015/01/30 11:24] – dmitry | rfc:php7_foreach [2015/02/12 13:13] – set status to implemented nikic | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2015-01-29 | * Date: 2015-01-29 | ||
* Author: Dmitry Stogov, dmitry@zend.com | * Author: Dmitry Stogov, dmitry@zend.com | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 230: | Line 230: | ||
* tests/ | * tests/ | ||
* tests/ | * tests/ | ||
+ | |||
+ | ===== Additional Behavoir Change ===== | ||
+ | |||
+ | With new implementation it's quite easy to stop using internal array/ | ||
+ | It means that reset/ | ||
+ | This would change the output of few examples above. | ||
+ | |||
+ | **foreach** (even foreach by reference) won't affect internal array pointer | ||
+ | |||
+ | < | ||
+ | $ php -r '$a = [1,2,3]; foreach($a as &$v) {echo $v . " - " . current($a) . " | ||
+ | 1 - 1 | ||
+ | 2 - 1 | ||
+ | 3 - 1 | ||
+ | </ | ||
+ | |||
+ | Modification of internal array pointer through next() and family doesn' | ||
+ | |||
+ | < | ||
+ | $ php -r '$a = [1,2,3,4]; foreach($a as &$v) {echo "$v - "; next($a); var_dump(current($a)); | ||
+ | 1 - int(2) | ||
+ | 2 - int(3) | ||
+ | 3 - int(4) | ||
+ | 4 - bool(false) | ||
+ | </ | ||
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
Line 250: | Line 275: | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
The vote is a straight Yes/No vote, that requires a 2/3 majority | The vote is a straight Yes/No vote, that requires a 2/3 majority | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | The second (Yes/No 50%+1) question is - if we should stop modifying internal array/ | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | The vote will end on February 12. | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
Line 255: | Line 294: | ||
Pull request for master branch: [[https:// | Pull request for master branch: [[https:// | ||
- | It doesn' | + | The implementation of additional idea is trivial [[https:// |
===== Implementation ===== | ===== Implementation ===== | ||
- | After the project is implemented, this section should contain | + | The RFC implemented |
- | - the version(s) it was merged to | + | |
- | - a link to the git commit(s) | + | [[http:// |
- | - a link to the PHP manual entry for the feature | + | |
- | ===== References ===== | + | [[http:// |
- | Links to external references, discussions or RFCs | + | |
rfc/php7_foreach.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1