Re: nulling out an array
| From: | Oyvind Gronnesby | Date: | Wed, 28 Jun 2000 15:21:14 +0000 |
| Subject: | Re: nulling out an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3572@lists.php.net to get a copy of this message | ||
Marc Swanson,
> Hello,
>
> I have an array that I want to destroy/null after each iteration of a while
> loop. essentially I'm pulling data from a database and I am running some
> calculations that I need to clear after each loop. What would really be
> cool is if I could find a way to declare the array local to the inside of
> the loop so it would go out of scope on block exit (each trip through the
> loop), but I notice that PHP seems to only do this in the case of
> subroutines. What is the best way to accomplish what I am doing? I tried
> setting the array = -1 at the beginning of the loop, but that causes an
> error when I try to treat it as an array later.
Using unset on the array might help you in this instance.
http://www.php.net/manual/function.unset.php
--
Øyvind Grønnesby
"Wow, I had knowledge!"
--Buffy