I have been searching and scratching my head for days and I'm stuck between a rock and a hard place. After all my previous code runs, I am left with this array:
Array (
[0] => Array
(
[0] => 1
[1] => 3
)
[1] => Array
(
[0] => 6
[1] => 7
[2] => 8
)
[2] => Array
(
[0] => 9
[1] => 10
)
)
What I need to do, is calculate every possible permutation of all keys.
The desired output needs to be easily insertable as either individual records or preferably a bulk insert into a sql database.
After my hunting around, I have tried countless examples. The closest I got was using an Implode function however this still wouldn't work.
Any help is greatly appreciated!
--Edit--
Here is an example of how the returned array should look:
Array
(
[0] => 1,6,9
[1] => 1,6,10
[2] => 3,6,9
[3] => 3,6,10
[4] => 1,7,9
[5] => 1,7,10
[6] => 3,7,9,
[7] => 3,7,10
)
This isn't every permutation, but should give you an idea of what I need to achieve.
What you are trying to do is defined in this formula:
And it might be done like that, it's called a Cartesian product: