On 25/08/12 13:33, Laruence wrote:
Great, now I can do in PHP what I've been able to do in Python for years, but with uglier syntax! :PHi: 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 <[email protected]> wrote:Hi: This feature introduces list() support in foreach constructs(more info 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/
-- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
