Re: [RFC] foreach_variable supporting T_LIST token

From: Date: Wed, 06 Jul 2011 13:15:14 +0000
Subject: Re: [RFC] foreach_variable supporting T_LIST token
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-53759@lists.php.net to get a copy of this message
Hi, On 07/06/2011 03:06 PM, Hannes Magnusson wrote: > 2011/7/6 Xinchen Hui <laruence@gmail.com>: >> >> T_LIST is not allowed to used with foreach before. >> >> and then there comes a freature request: #10203 allow >> foreach($array as list($a,$b) > > Ironically enough you managed to miss the last closing ), enforcing > the point of this not being a natural syntax. > > Furthermore, without reading the RFC, is this the same as > foreach($array as $a => $b) {} No, there $a would be the key. Intention would be, as I read the RFC, that this could be an arbitrary list. > or > foreach($array as $e) { > list($a, $b) = $e; > } Yes, I understood if like that. Just a short notation. > or.. ? > > that really doesn't look like something PHP should support imo. Don't see too many bad things about the idea ... Regards, Stefan

« previous php.internals (#53759) next »