in reply to faster way for multiple foreach loops
Apart from that, you want no more than the absolute minimum set of steps necessary to happen within the inner-most loop -- move as many things to the outer-most loop (or as far outward from the inner-most loop) as possible.
And that's about all you can do, without reducing the number of layers or iterations.
|
|---|