2 ms·
You can do it very simple by writing a custom generator function: foreach(myfunc($array) as list($key, $value, $loop)) {} Maybe you can array destructuring at
by tpetry 6y ago
You can do it very simple by writing a custom generator function:
foreach(myfunc($array) as list($key, $value, $loop)) {}
Maybe you can array destructuring at this place, i am not sure at the moment.
And your manual counting you do in myfunc() and just yield the values