Re: big reference bug in (at least) PHP 5.0.5
| From: | Ron Korving | Date: | Fri, 16 Sep 2005 13:11:45 +0000 |
| Subject: | Re: big reference bug in (at least) PHP 5.0.5 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-19053@lists.php.net to get a copy of this message | ||
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" <matthew@teh.ath.cx> 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. :)