Multiple choice php

A constructor is a special kind of…

  1. Class

  2. Method

  3. Object

  4. Variable

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A constructor is a special method within a class that is automatically called when an object is instantiated. It initializes the object's properties and sets up any necessary resources. Constructors have the same name as the class (in PHP 4) or use __construct() (in PHP 5+).