[VOTE]Call for voting: support use list in foreach
| From: | Laruence | Date: | Sat, 18 Aug 2012 04:34:32 +0000 |
| Subject: | [VOTE]Call for voting: support use list in foreach | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-62232@lists.php.net to get a copy of this message | ||
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/