The special syntax __construct() method is used to set initial values upon class instantiation. The special __destruct() will call called when an object is unset or the script ends.

Calling the function

in the function

in the constructor

about to leave the function

in the destructor

End function call
Begin direct call:

Creating new object

in the constructor

About to delete the object

End of Script

Toggle Sidebar

in the destructor