Re: [PHP] foreach and destroying variables for memory saving

2008-12-10 Thread ceo
PHP does have garbage_collection, and it's crucial in long-running CLI scripts. Per is right, though, in that if your web-page Apache PHP script needs GC, you are doing something terribly wrong. It is not as aggressive/thorough as, say, the Lisp GC, but it's there. ymmv -- PHP Genera

Re: [PHP] foreach and destroying variables for memory saving

2008-12-10 Thread Per Jessen
Tim | iHostNZ wrote: > Somewhere i also read that one can save a lot of memory by destroying > variables. Is that done with unset, setting it to null or something > similar? unset() > So, i take there is no garbage collection in php? I've never > actually looked at the c source code of php. Ma

[PHP] foreach and destroying variables for memory saving

2008-12-10 Thread Tim | iHostNZ
Hi All, Just to annoy the hell out of you, another thing that has been on my mind for a while: I love the foreach ($ar as $k => $v) { ... } construct and use it all the time. However, I read somewhere that foreach actually uses a copy of $ar instead of the array itself by reference. Wouldn't it b