M
M
MaMkO2019-11-09 11:09:37
PHP
MaMkO, 2019-11-09 11:09:37

How to iterate over all possible combinations between arrays?

Hello, could you tell me how to iterate over all possible combinations between arrays?
Let's say there are three arrays
$a = array('20', '25, '30');
$b = array('100', '150, '200');
$c = array('6000', '6500, '7000');
The output should be
20x100x6000
20x150x6000
20x100x6500
25x100x6000
etc...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2019-11-09
@MaMkO

3 nested loops.
well, or recursion if the depth is not static

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question