Constants

A class constant is a fixed value that belongs to the class itself, not to a specific object.

It is declared using the const keyword inside the class. Once defined, it cannot be changed.

Unlike properties, constants are not accessed through $this and do not require an object to be used. They are tied to the class definition.

By default, class constants are public.

A constant can be accessed from outside the class using the scope resolution operator:
ClassName::CONSTANT_NAME

Inside the class, it is accessed using:
self::CONSTANT_NAME

Constants are typically written in uppercase to signal that their value does not change.

Conceptually, constants represent fixed configuration or rules that belong to the class structure rather than to individual object state.