Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!
We spend hours on Instagram and YouTube and waste money on coffee and fast food, but wonβt spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!
Learn from Guru Rajesh Kumar and double your salary in just one year.
Constructor is a method (FUNCTIONJ) defined inside a class is called automatically at the time of creation of object. Main aim of a constructor method is to initialize the object. In PHP, a method of special name __construct acts as a constructor.
There are two type of constructor in PHP
- Default constructor
2. Parameterized constructor
Default constructor
In default constructor ther are no parameter passed during the creation of constructor.
eg:-

Parameterized constructor
In parameterized constructor the are one or more than one parameter passed during the creation of constructor.
eg:-
