Re: [PHP] destructor not called for static members?

2005-03-10 Thread Jochem Maas
Richard, OP, Richard Lynch wrote: Richard Lynch wrote: class c2 { private static $_ref; public function __construct() { self::$_ref = new c1(); //$this->_ref = new c1(); } } $obj = new c2(); unset($obj); ?> self::$_ref is completely independent of any instance of that class. c2::$_ref

Re: [PHP] destructor not called for static members?

2005-03-10 Thread Richard Lynch
> Richard Lynch wrote: >class c1 { >>> public function __destruct() { >>> echo '__destruct'; >>> } >>>} >>> >>>class c2 { >>> private static $_ref; >>> >>> public function __construct() { >>> self::$_ref = new c1(); >>> >>> //$this->_ref = new c1(); >>> } >>>} >>> >>>$ob

Re: [PHP] destructor not called for static members?

2005-03-10 Thread Jochem Maas
Richard Lynch wrote: 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

RE: [PHP] destructor not called for static members?

2005-03-10 Thread Richard Lynch
> 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 though

Re: [PHP] destructor not called for static members?

2005-03-10 Thread M. Sokolewicz
Jochem Maas wrote: Robert Janeczek wrote: [EMAIL PROTECTED] wrote: Hi It is an expected behavior because when you define a static variableit 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 l

Re: [PHP] destructor not called for static members?

2005-03-10 Thread Jochem Maas
Robert Janeczek wrote: [EMAIL PROTECTED] wrote: Hi It is an expected behavior because when you define a static variableit 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

Re: [PHP] destructor not called for static members?

2005-03-10 Thread Robert Janeczek
[EMAIL PROTECTED] wrote: Hi It is an expected behavior because when you define a static variableit 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. yes, but why d

RE: [PHP] destructor not called for static members?

2005-03-10 Thread YaronKh
yaron -Original Message- From: Robert Janeczek [mailto:[EMAIL PROTECTED] Sent: Thursday, March 10, 2005 1:28 PM To: php-general@lists.php.net Subject: [PHP] destructor not called for static members? am i missing something or destructor isn`t called for objects that are assigned to static fields in

[PHP] destructor not called for static members?

2005-03-10 Thread Robert Janeczek
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: class c1 { public function __destruct() { echo '__destruct'; } } class c2 { private static $_ref; public function __construct() { self::$_