Re: Re: [VOTE]Call for voting: support use list in foreach
| From: | Andrew Faulds | Date: | Sat, 25 Aug 2012 12:36:46 +0000 |
| Subject: | Re: Re: [VOTE]Call for voting: support use list in foreach | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62481@lists.php.net to get a copy of this message | ||
On 25/08/12 13:33, Laruence wrote:
Hi:-- Andrew Faulds http://ajf.me/Voting closed.Result: foreach supports list syntax: 11 for yes, 4 for no. accepted. foreach supports list with silent token: 2 for yes, 10 for no. denied.thanks for your great advise.I will commit the patch later.thanks On Sat, Aug 18, 2012 at 12:34 PM, Laruence <laruence@php.net> wrote:Hi:Great, now I can do in PHP what I've been able to do in Python for years, but with uglier syntax! :PThis feature introduces list() support in foreach constructs(moreinfo can be found here: https://wiki.php.net/rfc/foreachlist).this could make the grammar more consistent, see following example:<?php $users = array(array('Foo', 'Bar'), array('Baz', 'Qux');); // Before foreach ($users as $user) {list($firstName, $lastName) = $user; echo "First name: $firstName, last name: $lastName. ";} // After foreach ($users as list($firstName, $lastName)) {echo "First name: $firstName, last name: $lastName. ";} ?> previous discussion could be found at : http://marc.info/?l=php-internals&m=134277050215818&w=2 please vote for this: https://wiki.php.net/rfc/foreachlist#vote thanks :) -- Laruence Xinchen Hui http://www.laruence.com/