Peter Lind wrote:
This is one example where references actually decrease memory usage.
The main reason is the recursive nature of the function. Try

BTW, it's not the recursive nature of the function causing the problem. It's the movement of the internal pointer within the array. When it moves the COW realizes the copy's pointer has moved and splits off the copy. You can verify this by echoing the memory usage when you first enter carray(). The spike occurs inside the foreach loop.

Application and Templating Framework for PHP

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to