No More Dynamic Properties in PHP 9. The Language is Evolving.
PHP 8.2 is just around the corner and it will deprecate dynamic properties, to remove them in PHP 9.
2 min readNov 1, 2022
The new PHP version 8.2, to be released later this month, will finally deprecate the creation of dynamic properties in classes.
The following code will fail in PHP 9. In version 8.2 it will still work but will raise a deprecation warning:
It’s possible to test this behavior already:
Programmers in love with magic can sleep well — the stdClass
and classes implementing magical __get
and __set
methods are unaffected!