RE: [PHP] Deleting Objects
| From: | John Coggeshall | Date: | Thu, 03 Apr 2003 06:04:00 +0000 |
| Subject: | RE: [PHP] Deleting Objects | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142078@lists.php.net to get a copy of this message | ||
yes, that's what I meant :) sorry if I was unclear... if any references
to a given variable still exist then the variable is not destroied in
memory.
-----Original Message-----
From: Leif K-Brooks [mailto:eurleif@buyer-brokerage.com]
Sent: Thursday, April 03, 2003 12:55 AM
To: John Coggeshall
Cc: trlists@clayst.com; php-general@lists.php.net
Subject: Re: [PHP] Deleting Objects
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.