Memory usage of foreach
- From: Daniel Klein <danielk@xxxxxxxxxxxxxxxx>
- Date: Tue, 08 Apr 2008 16:39:13 GMT
I read somewhere that 'foreach' iterates over a 'copy' of the array, whereas
doing something like:
while (list($key, $value) = each($myarray))
iterates over the original array. Up til now, I've been using the 'foreach'
method.
If this is true then I'm concerned about memory usage as some of the arrays
I'm working on can grow fairly large.
Is it possible to check memory usage of your php program?
I may be converting code over to the list() method. What are the caveats of
doing this?
Daniel Klein
.
- Follow-Ups:
- Re: Memory usage of foreach
- From: Michael Fesser
- Re: Memory usage of foreach
- From: macca
- Re: Memory usage of foreach
- Prev by Date: Re: praca
- Next by Date: Re: Can $_POST variables be modified in a function?
- Previous by thread: praca
- Next by thread: Re: Memory usage of foreach
- Index(es):
Relevant Pages
|