RE: [PHP-WIN] unsetting variables
| From: | Gavin Chalkley | Date: | Sat, 14 Apr 2012 07:57:10 +0000 |
| Subject: | RE: [PHP-WIN] unsetting variables | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-30840@lists.php.net to get a copy of this message | ||
R P,
I wasn't aware that they cleaned automatically(still learning)
From: r p [mailto:four.zero.one.unauthorized@gmail.com]
Sent: 14 April 2012 00:10
To: Gavin
Cc: php-windows@lists.php.net
Subject: Re: [PHP-WIN] unsetting variables
You could do something like this...
foreach (get_defined_vars() as $var => $val) {
unset($$var, $var, $val);
}
But this would be completely unnecessary and redundant. At the end of a function or on return, all
variables and internal reference counts within the scope of the function are essentially cleaned up
or removed automatically, and garbage collection takes care of it from there (see: http://us.php.net/manual/en/features.gc.refcounting-basics.php).
What specifically are you trying to accomplish or what problem are you facing?
On Mon, Apr 9, 2012 at 12:01 PM, Gavin <gavin.chalkley@gmail.com> wrote:
Hello All,
Is there a way to unset all variables within a function?
Or has this got to be done on an individual basis?
--
Best Regards,
Gavin Chalkley