Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41312 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20084 invoked from network); 22 Oct 2008 01:03:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Oct 2008 01:03:22 -0000 X-Host-Fingerprint: 71.10.109.230 71-10-109-230.dhcp.stcd.mn.charter.com Received: from [71.10.109.230] ([71.10.109.230:8925] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/C0-10341-9DB7EF84 for ; Tue, 21 Oct 2008 21:03:21 -0400 Message-ID: To: internals@lists.php.net Date: Tue, 21 Oct 2008 20:03:18 -0500 User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 71.10.109.230 Subject: Destructor Order From: rpanning@gmail.com (Ryan Panning) I've been wondering, is such a thing even possible? Is there a good way to implement an object destruct order? Here are my thoughts: In the class definition, specify what "level" of destruction the objects should be on. How, I have no idea, I haven't thought of a good syntax. It should be an integer for what level though. Then when the script ends, the engine starts with the highest most level of destruction. It continues down until everything has been destructed. With the last most level being objects with unspecified levels. Note: Each level can have more than one class. Example destruction order: 3 = database records (ActiveRecord or such) 2 = database connection object 1 = framework objects 0 = objects with unspecified level