Since PHP 8.1, regular mutable objects can be used as constants via the `const` keyword or `define()`, a side effect of adding enum support. While enum cases are objects and can be constants, this inadvertently allowed any mutable object to be declared as a constant. The object's state can still be changed through method calls,
Table of contents
A short history lessonEnums are classes, and enum cases are objectsDefining constant objectsUsing constant objectsWhat do we take from it?Sort: