I've seen other messages about this type of thing, but not specifically for what I want to do...
I have multiple arrays of single characters. e.g.
$array1 = ('a', 'b', 'c')
$array2 = ('1', '2','3','4')
$array3 = ('x','y')
and I want to find all of the possible permutations (as strings in an array) for taking one character from each string (in order). So the result for the above would be :
$result[0] = 'a1x'
$result[1] = 'a1y'
$result[2] = 'a2x'
$result[3] = 'a2y'
and so on to
$result[n] = 'c4x'
The alogrithm needs to be able to take up to ten arrays (defined at run time) each with up to ten elements in. The number of elements will vary from array to array. I am thinking that this needs recursion, but I am stuck as a) recursion never was my hot subject! and b) I have only been able to find solutions for getting all of the permutations from one individual array (and I can't get my head around making those work for multiple arrays).
Any help or pointers is (as always!) much appreciated
Rob