What’s New in PHP 8.2
PHP 8.2 is a major update of the PHP language. It contains many new features, including readonly classes, null, false, and true as stand-alone types, deprecated dynamic properties, performance improvements and more.
Read Only Classes
You can now make the whole class as just read-only.
Disjunctive Normal Form (DNF) Types
Null, True, and False as Standalone Types
Three new standalone types have been added in PHP 8.2
New Random Extension
The “random” extension provides a new object-oriented API to random number generation. Instead of relying on a globally seeded random number generator (RNG) using the Mersenne Twister algorithm the object-oriented API provides several classes (“Engine”s) providing access to modern algorithms that store their state within objects to allow for multiple independent seedable sequences.
Constant in Traits
You cannot access the constant through the name of the trait, but, you can access the constant through the class that uses the trait.
Deprecate dynamic properties
The creation of dynamic properties is deprecated to help avoid mistakes and typos, unless the class opts in by using the
stdClass allows dynamic properties.
Usage of the
__set magic methods is not affected by this change.