Re: foreach, assigning to a reference, and E_NOTICE
| From: | Lukas Smith | Date: | Tue, 07 Mar 2006 07:41:36 +0000 |
| Subject: | Re: foreach, assigning to a reference, and E_NOTICE | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-22167@lists.php.net to get a copy of this message | ||
Sean Coates wrote:
How would you supress the notice (I know error suppression is ugly), but we need to make it possible for people to quickly adapt to this change if they indeed relied on this. would this work: foreach ($i as @&$j) {} regards, Lukasit's not the problem of the second foreach, any usage of $j after the 1st foreach as &$j will hurtYes. I thought it was clear that I understand this. I guess not. My point is that foreach is doing something that isn't immediately obvious. The same is true of your for loop, but to a lesser extent, IMO (as I don't expect your for loop to ONLY read from $i). I don't want to start a discussion on references. I'm just trying to clear up a non-obvious case.