PHP theorytheory 0/50 · 0%
OOP · easy

10. Classes & Objects

Basic object orientation.

Classes are declared with the class keyword and instantiated with new. Properties and methods can be public, protected, or private, controlling visibility from outside code and subclasses.

The $this pseudo-variable refers to the current instance inside methods, and constructors are defined via __construct().

Check your understanding

  1. 1. Which keyword creates a new instance?

  2. 2. What is the constructor method named?