What does the readonly property modifier introduced in PHP 8.1 do?
- A Prevents the property being written after initialisation
- B Makes the property private
- C Prevents the class being extended
- D Caches the property value
Answer
Prevents the property being written after initialisation
readonly combined with promoted constructor properties makes immutable value objects straightforward, which was awkward before.





