Re: [PHP-DEV] Request for comment From: Andi Gutmans (andi <email protected>)
Date: 08/10/00

At 12:21 AM 8/11/00 +0200, waldschrott wrote:

>>What happened here is that $b was effected by the traversing of $a where
>>it shouldn't have. I have fixed this.
>>What also works is foreach(array(1,2,3 as $ka => $va)
>>The main problem is with weird expressions in foreach such as
>>foreach($a=$b) which would still have such side effect issues. I think
>>this code is obscure and the change of people using it is slim.
>>I would like to change foreach to only support:
>>a) foreach($var) where var could be any variable/multi-dimensionaly
>>variable ($a[0]).
>>b) foreach(array(....))
>>Does anyone see a problem with this? It would mean you can't put obscure
>>stuff into foreach().
>
>realized too late you already commented,
>I wouldn´t call it obscure, but if it isn´t possible one has to finish
>building/creating the array outside foreach(), shouldn´t be that much
>impact if we disallow anything but (a) and (b)
>
>you´re at topic now ;) , what about another feature request I´ve posted
>adding the ability to use statements like list
>
>foreach ($multidimarray AS list($key,$array2))
>
>would simplify multi-dim array stuff

Let's pass the current mishaps of foreach() and later on see if we can add
more ability to it.
Why don't you bring it up again in a month or so when 4.0.2 is out and we
feel comfortable with the stability?

Andi

---
Andi Gutmans <andi <email protected>>
http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>