Re: Request for comment
| From: | Andi Gutmans | Date: | Thu, 10 Aug 2000 22:28:23 +0000 |
| Subject: | Re: Request for comment | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-28521@lists.php.net to get a copy of this message | ||
At 12:21 AM 8/11/00 +0200, waldschrott wrote:
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@zend.com> http://www.zend.com/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