Re: Remove vars from memory?
| From: | Dan Anderson | Date: | Sat, 06 Sep 2003 19:31:02 +0000 |
| Subject: | Re: Remove vars from memory? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161867@lists.php.net to get a copy of this message | ||
> yes, you must use unset() to remove a variable, otherwise it will stay
> for the duration of the script.
Don't worry about memory management if you're going to use PHP. The
point of using a high level language like PHP is you can just ignore
it. Let's say you decided to:
if ($temp)
{ /* something */ }
unset $temp; // save a couple bytes of memory
And you decided to reuse $temp a few weeks later:
if ($temp) // never will execute because you forgot you unset($temp);
{ /* something */ }
So unless you're dealing with an extreme scenario (i.e. a number of very
large mySQL queries), you probably don't need to worry.
-Dan