Re: [PHP] Need routine to tell me number of dimensions in array.

[email protected] (Robert Cummings)
Newsgroups php.general
Organization InterJinn
Message-ID <[email protected]>
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.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.