OOPS in PHP 5 - __destruct() Method
Destructor are special function in Object Oriented Programming. It gets called automatically whenever object of a class is destroyed or goes out of scope. This is useful for clean up operation before cleaning the memory. PHP 5 uses special keyword “__destruct” to define destructor of the class.
Example on Destructor Class in PHP 5:
< ? class employee { function __destruct() { echo "Destructor Called"; } } $a = new employee(); ?>
So when the page operation is completed destructor function is called automatically.
NOTE:
Destructor should be define as public access specifier.
Custom Search
Related Post
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.












































Comments
No comments yet.
Leave a comment