Information Technology Questions and Answers Community

Using construct() and destruct() methods in PHP

What is the significance of construct() and destruct() methods within a PHP class?

OOPS         PHP        
Your Answer: 

1 Answers

These are the built-in methods of PHP class. Once the new instance of the class is created, the construct() method gets called. It also initializes the class properties. Whereas, destruct() method does not need any parameter. It is the perfect example of implementing OOPS within PHP paradigm.

Answered On 04 Apr at 10:20
Edit Account
Change Settings
Email Notifications Notifications will be sent to
Select option for your email notifications:
Mature / News Filter We'll send on email when new jobs are posted
Option 2 for email notification We'll send on email when new jobs are posted