destroying objects in an array in PHP5
| From: | Erik Franzén | Date: | Tue, 27 Jul 2004 19:12:34 +0000 |
| Subject: | destroying objects in an array in PHP5 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-192002@lists.php.net to get a copy of this message | ||
See the following example:
<?PHP
$oObjectA = array();
$oObjectB = array();
for(i=0;i<10;i++) {
$oObjectA[$i] = new foo();
$oObjectB[$i] = $oObjectA[$i];
}
?>
How do I remove an element in the oObjectA array without destroying the object? I do not want to clone any object.
If I call unset($oObjectA[3]), the object will also be destroyed. apparently $oObjectB[3] is also destroyed?
/Erik