Question Detial
A constructor is a special kind of a method. It is automatically called when the object is created. The purpose of the constructor is to initiate the state of the object. The name of the constructor in PHP is __construct() (with double underscores).
There are 3 type of constructor in php -
- Default - __construct() is not declared, then uses default. By default it is non-Parameterized.
- Parameterized - __construct() is declared with parameter:
- Copy - __clone(). it is used to create copy one.
Hot Questions
How to Get the Size of all Tables in a database in MySQL?