foreach() With All The Same KeysΒΆ

It is possible for a foreach() loop to produce multiple times the same key. To do so, avoid using arrays, which enforce the unique key.

One need to use a generator or a Traversable class, where the same key is always yielded.

../_images/foreach_same_keys.png