Sr. PHP Programmer Question:
Download Questions PDF

What are the __construct() and __destruct() methods in a PHP class?

Senior PHP Programmer Interview Question
Senior PHP Programmer Interview Question

Answer:

All objects in PHP have Constructor and Destructor methods built-in. The Constructor method is called immediately after a new instance of the class is being created, and it's used to initialize class properties. The Destructor method takes no parameters.

Understanding these two in PHP means that the candidate knows the very basics of OOP in PHP.

Download Senior PHP Programmer Interview Questions And Answers PDF

Previous QuestionNext Question
What are the main error types in PHP and how do they differ?How does one prevent the following Warning 'Warning: Cannot modify header information - headers already sent' and why does it occur in the first place?