foreach() With All The Same Keys

no-email (Damien Seguy), Damien Seguy
Sun, 02 Apr 2023 00:00:00 +0000

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.