Tag Archives: destructor

Constructors and destructors in PHP

You might want to execute code when an instance of an object gets constructed or destructed. PHP offers constructors and destructors for this purpose. A constructor can be created by declaring a function called __construct within a class and a destructor can in turn be created by declaring a function called __destruct. <?php class Foo [...]

Posted in PHP | Also tagged , , , , , , | Leave a comment