To give a hint of how to perform the actual combination do it on paper first. Have 2 arrays, each with 2 values. Now on paper perform the combinations (there are only 4 of them so it should be easy). Then do it for arrays with 3 values instead. After that do it with arrays with 2 values again but use 3 arrays instead.

After that is done it should not be too difficult to write code that does what you just did on paper.