Zombie Jhakkaas
New member
I have an array with following structure
Array(
[0] =>([0]=> "A")
[1] => ([0]=>"A", [1]=>"B")
[2] => ([0]=>"A", [1]=>"B", [2]=>"C")
[3] => ([0]=>"A")
[4] => ([0]=>"A", [1]=>"B")
This is abstract. The point is i have an array where there are elements having different counts of elements. Can any body provide me with a code or idea on how to generate all combination's for this array's elements
The result should look like this
[0][0], [1][0], [2][0], [3][0], [4][0]
[0][0], [1][0], [2][0], [3][0], [4][1]
[0][0], [1][0], [2][1], [3][0], [4][0]
[0][0], [1][0], [2][1], [3][0], [4][1]
[0][0], [1][0], [2][2], [3][0], [4][0]
[0][0], [1][0], [2][2], [3][0], [4][1]
... and so on
Simply it should give me the combinations of all elements taking one element at a time from each sub element of the main array.
Can anybody please help!
Thanks in advance
Array(
[0] =>([0]=> "A")
[1] => ([0]=>"A", [1]=>"B")
[2] => ([0]=>"A", [1]=>"B", [2]=>"C")
[3] => ([0]=>"A")
[4] => ([0]=>"A", [1]=>"B")
This is abstract. The point is i have an array where there are elements having different counts of elements. Can any body provide me with a code or idea on how to generate all combination's for this array's elements
The result should look like this
[0][0], [1][0], [2][0], [3][0], [4][0]
[0][0], [1][0], [2][0], [3][0], [4][1]
[0][0], [1][0], [2][1], [3][0], [4][0]
[0][0], [1][0], [2][1], [3][0], [4][1]
[0][0], [1][0], [2][2], [3][0], [4][0]
[0][0], [1][0], [2][2], [3][0], [4][1]
... and so on
Simply it should give me the combinations of all elements taking one element at a time from each sub element of the main array.
Can anybody please help!
Thanks in advance