Re: [RFC] foreach_variable supporting T_LIST
| From: | Laruence | Date: | Fri, 20 Jul 2012 07:43:04 +0000 |
| Subject: | Re: [RFC] foreach_variable supporting T_LIST | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-61541@lists.php.net to get a copy of this message | ||
Hi:
since I proposed last year, and seems no argu here.
so maybe we can just step into the voting phase?
thanks
On Wed, Jul 18, 2012 at 10:55 PM, Laruence <laruence@php.net> wrote:
> On Wed, Jul 18, 2012 at 10:49 PM, Laruence <laruence@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.
> thanks phidev's good english, he re-wrote the descriptions.
>
> thanks
>>
>> This feature introduces list() support in foreach constructs(more
>> info can be found here: https://wiki.php.net/rfc/foreachlistjÏu¡Þú
>> "ÑWÓtãŽ):
>>
>> <?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/
>
>
>
> --
> Laruence Xinchen Hui
> http://www.laruence.com/
--
Laruence Xinchen Hui
http://www.laruence.com/