Destruct Method

 <?php

//__destruct() method will automatically call when object related all the operations will completed
//as shown below:

class Abc
{
    public function __construct()
    {
        echo "This is Construct Function" . "<br>";
    }
    public function hello()
    {
        echo "Hello Everyone" . "<br>";
    }
    public function __destruct()
    {
        echo "This is destruct Function" . "<br>";
    }
}
$test = new Abc();
$test->hello();
$test->hello();
$test->hello();

//OUTPUT:
//This is Construct Function
// Hello Everyone
// Hello Everyone
// Hello Everyone
// This is destruct Function
?>

Comments

Popular posts from this blog

Logical_Operators

SubQuery with EXISTS and NOT EXISTS in PHP

Get Functions