Sounds great. Python has something similar for tuples, would be good if PHP had this.
Are there any BC concerns? Don't see why this could break something. On Jul 18, 2012 3:50 PM, "Laruence" <larue...@php.net> wrote: > Hi: > this is not a new RFC, I proposed it before, but due to my poor > english and improper examples, it didn't get passed. > > This feature introduces list() support in foreach constructs(more > info can be found here: https://wiki.php.net/rfc/foreachlist): > > <?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. "; > } > ?> > > what do you think? personally, I really think it's a good feature. > > what about commit this into trunk(php 5.5) ? > > thanks > > -- > Laruence Xinchen Hui > http://www.laruence.com/ > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >