Re: Deleting Objects

From: Date: Thu, 03 Apr 2003 05:55:00 +0000
Subject: Re: Deleting Objects
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-142077@lists.php.net to get a copy of this message
Not exactly true. unset() destroys the reference to the value, not the value itself. For instance, error_reporting(E_ALL); $var1 = "foo"; $var2 = &$var1; print "$var1\n$var2\n\n"; unset($var1); print "$var1\n$var2"; will output: foo foo <br /> <b>Notice</b>: Undefined variable: var1 in <b>PHPDocument1</b> on line <b>7</b><br /> foo In other words, unsetting $var1 will NOT destroy $var2. John Coggeshall wrote:
If you want to force a variable to be destroied, just unset() it.
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.

« previous php.general (#142077) next »