Sylvain Rabot wrote: > Hello, > > First of all I would like to know if one day we will be able to unset > $this into a class in order to destroy the object. It could really be > useful to prevent big memory usage. > > As it can't be done I tried to unset an object by unsetting a reference > of this object but it has no effect on the object but only on the > reference. > > Should unset destroy the reference itself and the object ??? > > if you don't think so can you think of something different to destroy > both of them like I don't know, destroy($obejctsreference) > > Regards. > > Reproduce code: > --------------- > <? > > $x = new stdClass(); > $x->a = 'ayayaye'; > > $b[0] =& $x; > > unset($b[0]); > > var_dump($x); > > ?> > > Expected result: > ---------------- > NULL > > Actual result: > -------------- > object(stdClass)#1 (1) { > ["a"]=> > string(7) "ayayaye" > } So if you unset a reference you are dereferencing it. If you want to unset both, then unset the object, in this case $x. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php