Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19053 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4166 invoked by uid 1010); 16 Sep 2005 13:11:48 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 4151 invoked from network); 16 Sep 2005 13:11:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Sep 2005 13:11:48 -0000 X-Host-Fingerprint: 195.225.34.5 fw01.axit.nl Received: from ([195.225.34.5:4258] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 3D/5F-43379-494CA234 for ; Fri, 16 Sep 2005 09:11:48 -0400 Message-ID: <3D.5F.43379.494CA234@pb1.pair.com> To: internals@lists.php.net References: <67.0C.43379.BCABA234@pb1.pair.com> <432ABD29.6000605@zend.com> <96.CE.43379.260CA234@pb1.pair.com> <432AC30D.1050105@teh.ath.cx> Date: Fri, 16 Sep 2005 15:11:45 +0200 Lines: 28 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Posted-By: 195.225.34.5 Subject: Re: [PHP-DEV] big reference bug in (at least) PHP 5.0.5 From: r.korving@xit.nl ("Ron Korving") Good point. I think it's somehow undesired behavior, but what can one do to change this? I guess it somehow is desired behavior... My bad I guess, Ron "Matthew Charles Kavanagh" schreef in bericht news:432AC30D.1050105@teh.ath.cx... > Ron Korving wrote: > > >The last item in the array is replaced, not by the first one of the second > >foreach, but by the item before the last item. That just doesn't make sense > >at all. > > > > > This is where you're going wrong (and where I was going wrong in > thinking about this before Antony's message). $item points to $array[2] > the whole time, and $array[2] is first overwritten by $array[0], then > $array[1], then $array[2]. > > This is a pretty interesting oddity in references that I hadn't > considered, though, and I'll be thinking about bizarre things I can do > with this for a while. :)