I have the following problem:
$multidmimensional = array(
[0] => array(
[0] => 1,
[1] => 2,
[2] => 3
);
[1] => array(
[0] => 5,
[1] => 6,
[2] => 7
);
...
[2] => array(
[0] =>,4
[1] => 5,
);
);
I can have one or more (nested) arrays, and lets take as an example the first two of the above arrays:
I should permutate them in the following way:
15
16
17
25
26
27
36
37
38
If I had for example those three arrays, I should get a result like this:
154
164
174
155
165
175
254
264
274
255
265
275
364
374
384
365
375
385
I am having some problems to make an algorithm that would fix this problem. Can anyone help me? Thanks in advance.
Fiddle
I can not test it right now but this should work: (may contain typos)
That's a nice brain teasing question. Here's what I came up with, see the running demo for testing and adjusting.