Hi It is an expected behavior because when you define a static variable it is shared by all objects of the same class. If When you unset one object and the destruct of the static object will be called, all the other objects will lose the static var as well. Hope I've helped yaron -----Original Message----- From: Robert Janeczek [mailto:rashid@xxxxxxxxxxxx] Sent: Thursday, March 10, 2005 1:28 PM To: php-general@xxxxxxxxxxxxx Subject: destructor not called for static members? am i missing something or destructor isn`t called for objects that are assigned to static fields in other objects? here is some example code: <?php class c1 { public function __destruct() { echo '__destruct'; } } class c2 { private static $_ref; public function __construct() { self::$_ref = new c1(); //$this->_ref = new c1(); } } $obj = new c2(); unset($obj); ?> i thought this should display __destruct in both cases from c2::__construct, but only the one with non static access seems to call c1::destruct. and if i remove unsetting $obj from the end of code this one also doesn`t work. is it expected behaviour? or maybe when __destructor is called after script finishes execution than output is no longer possible? i tried also send some information to file and this also didn`t work. help please :) php 5.0.3 rash -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php