Combination of group's math php function -
looking function in php possible element combinations of unknown number of groups {x, y...z}...{x,y...z} example:
a:{1,2,3,4},b:{5,6},c:{a,b,c}
result:
abc 15a 15b 15c 16a 16b 16c 25a 25b 25c 26a 26b 26c 35a 35b . . . 46c
thanks
i need not working
$array = array( 'a' => array(1, 2, 3, 4), 'b' => array(5, 6). 'c' => array('a', 'b', 'c')) function makecombinations($array){ foreach($array $value){makecombinations($array) } }
try this.
assuming ,b , c arrays
$a = array(1,2,3,4); $b = array(5,6); $c = array("a","b","c"); foreach($a $values) foreach($b $values2) foreach($c $values3) echo $values."".$values2."".$values3."\n";
Comments
Post a Comment