Re: Re: [RFC] foreach_variable supporting T_LIST
| From: | Stas Malyshev | Date: | Fri, 20 Jul 2012 22:28:27 +0000 |
| Subject: | Re: Re: [RFC] foreach_variable supporting T_LIST | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-61586@lists.php.net to get a copy of this message | ||
Hi!
> If I understand this correctly, this is like what Python let's you do
> with tuples. It's handy for getting vector components, hostnames and
> port numbers, etc. (I apologise for the Python comparison, it is just
> the language where I usually encounter this, and it makes heavy use of
> foreach-style loops and tuples)
There's no need to apologize for Python comparison, Python is not a
dirty word :) However, in PHP functions rarely return sets of tuples
that can be manageably unpacked by this foreach syntax - usually it's
either something like DB result set, which has unpredictable number of
values, or one set of values, which doesn't need foreach. That's why I
wanted to see a use case where this is beneficial.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227