Re: destroying objects in an array in PHP5

From: Date: Tue, 27 Jul 2004 19:22:05 +0000
Subject: Re: destroying objects in an array in PHP5
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192003@lists.php.net to get a copy of this message
I am correcting myself... <?PHP class foo {} $oObjectA = array(); $oObjectB = array(); for($i=0;$i<2;$i++) { $oObjectA[$i] = new foo(); $oObjectB[$i] = $oObjectA[$i]; } unset($oObjectA[1]); var_dump($oObjectA); var_dump($oObjectB); ?> will output: array(1) { [0]=> object(foo)#1 (0) { } } array(2) { [0]=> object(foo)#1 (0) { } [1]=> object(foo)#2 (0) { } } So my question is, how do I destroy the object $oObjectA[1] in both arrays?

« previous php.general (#192003) next »