Re: unset( $anobject) does not invoce __destruct()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



kranthi wrote:
unset($obj) always calls the __destruct() function of the class.

Never calls the dtor. The dtor will be called only when the reference count reaches 0.

class c { function __destruct() { echo 'dying !' ; } }
$v1 = new c ;
$v2 = $v1 ;

unset($v1) ; // don't call the dtor
unset($v2) ; // call the dtor

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux