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
regards
--
o----------0-¬---------O-·---¬----o---®-----o o O ° .
| http://www.kiffen.de | pRoteçt y0ur bRaín |0 O ° ¤ °
·
0°·³°²'²³-¹'³´³°^°³~³²³°'³²²¨³²^³¹³²°²³`³º³°Þ °
o © ° . ·
| psychedelic experience | gott@kiffen.de | O ° o °
o-¬--o--0-----©-·--O-----o-----0-¤----------o 0 ° · ° . ¤ ·