> Ok, I asked a similar question more than a year ago, so I apologize for
> being a little redundant :)
>
> Why was PHP's foreach loop syntax chosen to be
>
> foreach($dogs as $dog){}
>
> instead of something more common (Python, Javascript, can't think what
else
> right now) and, to me, more intuitive, like
>
> foreach($dog in $dogs){}
>
> Just wondering what the reasoning was. Thanks.
Wild Speculation:
Well, we needed the variant of:
foreach($dogs as $index=>$dog){}
and we already had the perfectly fine:
while (list($index, $dog) = each($dogs)){}
and if we did it your way, it wouldn't be all that different from that :-)
[asbestos on]
Disclaimer: I haven't even figured out why anybody wanted the damn thing in
the first place. Clutters up the language and provides no new
functionality. :-)
[asbestos off]
If you really wanna know, go read the source and find out who added it, and
ask them, or check the PHP-DEV archives where I'm betting it was argued at
length how to do it.
--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]