Unset and __destruct
| From: | Pierre du Plessis | Date: | Thu, 06 Dec 2012 21:27:08 +0000 |
| Subject: | Unset and __destruct | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-319807@lists.php.net to get a copy of this message | ||
Hi all
I searched the internet (probably not hard enough), and couldn't find a
decent answer.
I was wondering why, when calling unset on an object, it doesn't
automatically call the __destruct method (if it exists) on the object.
When unsetting an object, php doesn't automatically remove references to
other objects, and you need to manually call the __destruct method where
you can remove any references to other objects.
I know there is a lot of discussion around this topic, but couldn't find a
definate answer as to why this isn't the default behaviour.
Any clarification would greatly be appreciated.