What is PHP oops - Destructor?
A destructor is called when the object is destructed or release any object from its memory.
A destructor is used to clean up resources from the memory.
You can define destructor by using __destruct function.
A Destructor method doesn't take any arguments
A Destructor does not return any data type.
The automatic destruction of class objects is handled by PHP Garbage Collector.
A Destructor is just called before de-allocating memory for an object or during the finish of execution of PHP scripts or as soon as the execution control leaves the block.
PHP Example :
// code by aryatechno!
echo "Learn php Course __destruct at aryatechno!";
echo "<br>Object is destroyed";
$learn = new Tutorials();
Learn php Course __destruct at aryatechno!
Object is destroyed