PHP 8.2 RFC: Unwrap reference after foreach
Unwrap reference after foreach | |
Improvement | |
PHP 8.2 | |
Withdrawn |
After a foreach by reference loop, the value variable currently remains a reference to the last array element, which may result in unexpected behavior if the variable is later reused. This RFC proposes to unwrap the reference after the foreach loop.