This code:
Produces this output:Code:<?php abstract class a { public function __construct () { echo 'constructing ', __CLASS__, '<br/>'; } public function __destruct() { echo 'destructing ', __CLASS__, '<br/>'; } } class b extends a { public function __construct() { echo 'constructing ', __CLASS__, '<br/>'; parent::__construct(); } public function __destruct() { echo 'destructing ', __CLASS__, '<br/>'; parent::__destruct(); } } class d { public function __construct() { echo 'constructing ', __CLASS__, '<br/>'; $this->b = new b(); } public function __destruct() { echo 'destructing ', __CLASS__, '<br/>'; $this->b->__destruct(); unset($this->b); } public $b; } new d(); ?>
The problem being the two last lines of output. The problem is related to d::b. Removing d::b causes everything to destruct correctly, but also completely ruins the functionality of what I'm trying to do :PCode:constructing d constructing b constructing a destructing d destructing b destructing a destructing b destructing a
It won't hurt my program to have b and a destruct twice, as long as they destruct after d, but I'd like to know why, if possible
Edit:
And for your time, 332 credits to whomever solves it(and some rep)


LinkBack URL
About LinkBacks

Reply With Quote
icon below! (this is even better than "liking" a post)

