jvlad wrote: >> $a = array(1); >> $b = 0; >> $c = &$b; >> foreach($a as $c); >> Now you are arguing that $b should not be 1? >> The two pieces of code are identical > > It's just a nightmare example. I wonder have you ever see anything like this > in real life? > Could you please let me see it too, for example in code.google.com? > If you cann't, what are you fighting for? > Interestingly, how many people will consider the code sample you > demonstrated ugly... > How many sporadic problems were already created and will be created just > beacause > of this unclear behavior of foreach?
It isn't unclear. It is perfectly consistent. Whether it is ugly or not is irrelevant. >> And I don't see how your prev/next stuff has anything to do with this. > > > Ok. What my stuff has to do with this is there: > If prev/next were consistent with foreach, they would return first/last > element of the > array respectively as soon as they reached the boundary. But no! They return > FALSE. Which has nothing to do with the question at hand here. We are talking about breaking any reference in the variables used in the loop construct. We are not talking about any other behaviour here. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
