Constructor and distructor both are used in object oriented programming. Here is a example of constructor in oop php
class Book{ public function __construct(){ echo "From constructor"; } }
Now when a user instantiate the class "Book" this constructor will fire automatically.
Instantiate class like this $book = new Book();
Constructor fires when we instantiate a class on the other hand destructor fires when class object gets destroyed.