I need to find all combinations of items in several arrays with fixed subset size. For example, I have the 3 arrays :
$A = array('A1','A2','A3');
$B = array('B1','B2','B3');
$C = array('C1','C2','C3');
I want to generate combinations of size 2 from the above arrays. Like:
$Combinations = array(
[0] => array('A1', 'B1'),
[1] => array('A1', 'C1'),
[2] => array('A2', 'B1'),
[3] => array('A2', 'C1')
);
This solution is generating all combinations, but does not seem to have size parameter in it.
Looking for help!