Hi internals, I'd like to propose a new language feature for PHP: Readonly Variables.
PHP currently has no way to declare a variable as immutable within a local or functional scope. This RFC proposes the readonly modifier for variables, which prevents reassignment after the initial declaration and results in an error on any attempt to do so. Key behaviors: - Reassignment and compound assignment operators are forbidden - Pass-by-reference is forbidden - unset() removes the readonly flag, allowing re-declaration - Readonly variables inside loops are permitted but limited to a single declaration - Scoping follows regular variable rules (function, method, closure boundaries) The RFC is available at: https://wiki.php.net/rfc/readonly-variables I'm looking forward to your feedback and discussion. Cheers, Joshua Rüsweg
