Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22167 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20987 invoked by uid 1010); 7 Mar 2006 07:41:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 20972 invoked from network); 7 Mar 2006 07:41:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2006 07:41:39 -0000 X-Host-Fingerprint: 87.123.92.216 i577B5CD8.versanet.de Received: from ([87.123.92.216:12810] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 12/AB-22029-2393D044 for ; Tue, 07 Mar 2006 02:41:38 -0500 Message-ID: <12.AB.22029.2393D044@pb1.pair.com> To: internals@lists.php.net Date: Tue, 07 Mar 2006 08:41:36 +0100 User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 References: <440C7D6F.7030809@caedmon.net> <28139bc0603061902t2cccc154ie76e7ca62a7ed781@mail.gmail.com> <002701c641a7$59f52620$7d051fac@stumpy> <28139bc0603062209x3be25866md3b6807555c98f1c@mail.gmail.com> <440D2ADB.80300@caedmon.net> In-Reply-To: <440D2ADB.80300@caedmon.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 87.123.92.216 Subject: Re: [PHP-DEV] foreach, assigning to a reference, and E_NOTICE From: lsmith@php.net (Lukas Smith) Sean Coates wrote: >> it's not the problem of the second foreach, any usage of $j after the >> 1st foreach as &$j will hurt > > Yes. 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. 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, Lukas