RE: unsetting variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



R P,

 

I wasn't aware that they cleaned automatically(still learning)

 

From: r p [mailto:four.zero.one.unauthorized@xxxxxxxxx] 
Sent: 14 April 2012 00:10
To: Gavin
Cc: php-windows@xxxxxxxxxxxxx
Subject: Re:  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@xxxxxxxxx> 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
 
 

 


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux