I want to ask about a quirk that I happened upon.  In truth, I expected my
code to fail with a fatal error, but it turns out that while using array
destructuring in the head of a foreach() loop it is permitted to declare
new elements if the value is a reference.

Is this a bug or an intended feature?

If not a bug should a note/section clarify this behavior?
https://www.php.net/manual/en/language.types.array.php

My demonstration can be found at this evidently unhelpful question:
https://stackoverflow.com/q/77741716/2943403

Reply via email to