Hello,
im trying to understand php constructor and destructor behaviour. Everything goes as expected with the constructor but i am having trouble getting the destructor to fire implicitly. Ive done all the reading on php.net and related sites, but i cant find an answer to this question.
If i have a simple class, something like:
class test{
public funciton __construct(){
print "contructing<br>";
}
public function __destruct(){
print "destroying<br>";
}
}
and i call it with something like:
$t = new test;
it prints the constructor message. However, i'd expect that when the scripts ends and the page is rendered that the destructor should fire. Of course it doesnt.
If i call unset($t); when the scripts ends, of course the destructor fires, but is there a way to get it to fire implicitly?
thanks for any tips