Skip to content
Advertisement

Combine 2 foreach loops into one with different logic

I’m looking for the way to combine 2 foraech loops into one (merge 2 functions): The result function should return both: ($is – boolean & $d – array). Traversable data in both functions – the same. Is it possible? What will be a good solution for that?

JavaScript

Thanks.

Advertisement

Answer

My take, but not tested.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement