CONSTRUCTOR in PHP

DevOps

YOUR COSMETIC CARE STARTS HERE

Find the Best Cosmetic Hospitals

Trusted • Curated • Easy

Looking for the right place for a cosmetic procedure? Explore top cosmetic hospitals in one place and choose with confidence.

“Small steps lead to big changes — today is a perfect day to begin.”

Explore Cosmetic Hospitals Compare hospitals, services & options quickly.

✓ Shortlist providers • ✓ Review options • ✓ Take the next step with confidence

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

  1. 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:-