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. :) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php