if you try to unset an object, please be careful about references.
Objects will only free their resources and trigger their __destruct method when *all* references are unsetted.
Even when they are *in* the object... sigh!
<?php
class A {
function __destruct() {
echo "cYa later!!\n";
}
}
$a = new A();
$a -> a = $a;
#unset($a); # Just uncomment, and you'll see
echo "No Message ... hm, what now?\n";
unset($a -> a);
unset($a);
echo "Finally that thing is gone\n";
?>
Of course the object completely dies at the end of the script.