php possible combinations of arrays?
Posted: Sat Jun 24, 2006 11:34 pm
hi all
ive got a problem that is giving me a headache trying to work out.
any help will be extremely appreciated!
here is an example:
$array_1 = array("a","b","c");
$array_2 = array("x","y","z");
$array_3 = array("hello","bob","cat", "mouse");
what i am trying to do is make an array with all the possible combinations of array's 1, 2 and 3
for example:
a, x, hello
a, y, hello
a, z, hello
a, x, bob
a, y, bob
etc ...
i need some sort of recursive function, as the amount of arrays will vary (sometimes 1, other times 3, maybe even 9).
any help would be very much appreciated!
thanks for your time,
mojoinst
ive got a problem that is giving me a headache trying to work out.
any help will be extremely appreciated!
here is an example:
$array_1 = array("a","b","c");
$array_2 = array("x","y","z");
$array_3 = array("hello","bob","cat", "mouse");
what i am trying to do is make an array with all the possible combinations of array's 1, 2 and 3
for example:
a, x, hello
a, y, hello
a, z, hello
a, x, bob
a, y, bob
etc ...
i need some sort of recursive function, as the amount of arrays will vary (sometimes 1, other times 3, maybe even 9).
any help would be very much appreciated!
thanks for your time,
mojoinst