[PHP] array_reverse() and garbage collection

2008-12-07 Thread Richard Heyes
Hi,] So I've been thinking, because occassionally I do, about array_reverse() and how to implement it. Of course, it's entirely theoretical, because it would a total waste of time. But I'm wondering which of two methods would be best. 1. Do it correctly and in place. ie, loop through the the

Re: [PHP] array_reverse() and garbage collection

2008-12-07 Thread Michael Kubler
What about using array_pop to take the bottom array element from the first one and add it to the second? So basically you are feeding the 2nd array from the bottom of the 1st one, and assuming garbage collection is done for each call of array_pop, then you'd only need the memory usage of one