more info.. http://evergreenphp.blogspot.com
Destructor 
void__d es tru ct ( void ) 
PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++.
The destructor method will be called as soon as all references to a particular object are removed or
when the object is explicitly destroyed or in any order in shutdown sequence.
name ="MyDestructableClass"; 
}function__destruct() { 
print "Destroying " .$this->name ."\n"; 
} 
}$obj = new MyDestructableClass(); 
?> 
Like constructors, parent destructors will not be called implicitly by the engine. In order to run a parent 
destructor, one would have to explicitly callp aren t::__d es tru ct() in the destructor body. 
Note: Destructors called during the script shutdown have HTTP headers already sent. The 
working directory in the script shutdown phase can be different with some SAPIs (e.g. 
Apache). 
Note: Attempting to throw an exception from a destructor (called in the time of script 
termination) causes a fatal error.
No comments:
Post a Comment