I would highly prefer php optimalization for it. ArrayKeysIterator can
not even used if the input is iterable instead of pure array.
With kind regards / Mit freundlichen Grüßen / S přátelským pozdravem,
Michael Voříšek
On 31 Aug 2020 23:31, Max Semenik wrote:
On Mon, Aug 31, 2020 at 11:53 PM Michael Voříšek - ČVUT FEL <voris...@fel.cvut.cz> wrote:
Optimizing foreach (array_keys($arr) as $k) is very important, not only
because of memory, but because of speed when not all elements needs to
be iterated, like:
foreach (array_keys($arr) as $k) {
if ($k some condition) {
break;
}
}
Can an iterator be the answer? E.g.
foreach (new ArrayKeysIterator($arr) as $k) { ... }
--
Best regards,
Max Semenik