foreach: clone array before iteration for copy-on-iterate semantics #3

Merged
thesimonharms merged 1 commit from jnana/foreach-copy-on-iterate into main 2026-10-13 19:00:04 -04:00 AGit
Contributor

This change ensures that modifications to the array inside a foreach loop
don't affect the iteration, matching PHP's behavior where foreach works
on a copy of the array.

Fixes: foreach copy-on-iterate (Roadmap Maybe later item)

This change ensures that modifications to the array inside a foreach loop don't affect the iteration, matching PHP's behavior where foreach works on a copy of the array. Fixes: foreach copy-on-iterate (Roadmap Maybe later item)
This change ensures that modifications to the array inside a foreach loop
don't affect the iteration, matching PHP's behavior where foreach works
on a copy of the array.

Fixes: foreach copy-on-iterate (Roadmap Maybe later item)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thesimonharms/pic!3
No description provided.