Re: Question about constructors and destructors

From: Date: Wed, 28 Jun 2006 19:27:36 +0000
Subject: Re: Question about constructors and destructors
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-238836@lists.php.net to get a copy of this message
I get: (on Linux, PHP 5.1.4) php cls_t.php Will build<br>Building<br>Finished building<br>Unseting<br>Destroying<br>Unset complete<br> Mathieu Dumoulin wrote:
I posted a bit earlier and did some other tests and now i have a VERY simple question... check the following code : ======================================= class test {
    public function __construct(){
        echo 'Building<br>';
    }
    public function __destruct(){
        echo 'Destroying<br>';
    }
} echo 'Will build<br>'; $mytest = new test(); echo 'Finished building<br>'; echo 'Unseting<br>'; unset($mytest); echo 'Unset complete<br>'; ======================================= Althought you may think this will give the following output: Will build Building Finished building Unseting Destroying Unset complete Instead it outputs the following: Will build Building Destroying Finished building Unseting Destroying Unset complete Notice the "Destroying" right after the building? Is that normal behavior, i just updated to PHP 5.1.4 for windows and IMO its not normal, can anyone test this on PHP 5 for linux see if it's only a windows issue!!!! This is really important thanks Math


« previous php.general (#238836) next »