Object-oriented PHP organises code into classes.
class Car { ... }defines a class;new Car()creates an object.__construct()runs when an object is created. Constructor promotion (PHP 8) declares properties in the parameters.$thisrefers to the current object; use->to access members.- Visibility:
public,protected,private. staticmembers belong to the class:Car::$count,self::.