Re: Re: destroying objects in an array in PHP5
| From: | Erik Franzén | Date: | Tue, 27 Jul 2004 19:54:26 +0000 |
| Subject: | Re: Re: destroying objects in an array in PHP5 | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-192007@lists.php.net to get a copy of this message | ||
$oObjectB[$i] = &$oObjectA[$i];
The above statement does not matter, because in PHP5 "objects are
referenced by handle, and not by value".
Look at this example:
<?PHP
class foo {}
$a = new foo();
$b = $a;
unset($a);
var_dump($b);
?This will output: object(foo)#1 (0) { } The object is not destroyed!? How do I destroy it without calling unset($b)? I my application I am "sending" arrays, which are "holding objects", to objects. If I want to destroy an object inside that array, I want to destroy it for all objects.