Re: [PHP-DEV] Declaring new elements as references while destructuring within a foreach() head

2024-01-02 Thread Kamil Tekiela
I don't know if this was designed this way purposefully, but it makes sense to me. I see nothing out of the ordinary here. It makes for some really nasty code, but that can probably be said about all code that uses references. If we try to simplify your example, we can see more clearly what's

[PHP-DEV] Declaring new elements as references while destructuring within a foreach() head

2024-01-02 Thread mickmackusa
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