Constructor
A constructor is a special method named __construct(). It runs automatically when a new object is created using the new keyword.
Instead of creating an object and then assigning its properties afterward, the constructor allows the object to be initialized immediately at creation time.
So instead of:
$sub = new Subscription();
$sub->set_details(…);
It becomes:
$sub = new Subscription(…);
The constructor receives arguments and assigns them to the object using $this. The object is born already configured.
This keeps initialization centralized, reduces repetitive setup code, and encourages creating fully valid objects from the start.
The mechanism is still normal property assignment. The difference is timing: the assignment happens automatically during object creation.