On 7 June 2011 15:53, John Crenshaw <johncrens...@priacta.com> wrote:

> > foreach ($arrays as list($e1, $e2, $e3)) { ...
>
> Disagree. This feels very obtuse. I wouldn't expect this construct to work
> at all, and even if it did, it is highly ambiguous (I.E. at first I thought
> you were intending to grab 3 entries at a time, rather than extracting
> entries from a second array).
>
> John Crenshaw
> Priacta, Inc.
>

I don't understand what's ambiguous? For each iteration the foreach assigns
the current value to the variable $value specified as either "as $key =>
$value" or "as $value". The "as" keyword is simply a type of assignment
operator that assigns the current element to the right expression. Since PHP
has a special "list()" language construct for assignment it doesn't make
sense that "list(...) = $something" assignment would work but not
"array($something) as list(...)".

Grabbing "3 elements at a time" is not logical at all. Why would the list
construct change how the foreach iterates?

Hannes

Reply via email to