foreach copy-on-iterate: docs, roadmap, and tests #4
Loading…
Reference in a new issue
No description provided.
Delete branch "Milo/pic:milo/foreach-copy-docs-and-test"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to the merged PR #3 ("foreach: clone array before iteration for copy-on-iterate semantics").
foreachwalks the live array without copying first.foreachcopy-on-iterate as done ([x]), since PR #3 implemented it.TestForeachCopyOnIterateAppend(appending insideforeachdoes not affect iteration: 3 iterations, 6 elements afterwards) andTestForeachCopyOnIterateUnset(unsetting an element insideforeachdoes not affect iteration: all three values 1, 2, 3 are visited), matching real PHP semantics.