//$a = [
// ['甲' => 'A', '乙' => 'B'],
// ['甲' => 'C', '乙' => 'D'],
// ['甲' => 'E', '乙' => 'F'],
// 。。。无限次
//];
$a = [
['甲' => 'A', '乙' => 'B'],
['甲' => 'C', '乙' => 'D'],
['甲' => 'E', '乙' => 'F'],
['甲' => 'G', '乙' => 'G'],
];
$b = ['甲', '乙'];
$count = count($a);
$num = pow(2, $count);
$str_arr = [];
for ($i = 0; $i < $num; ++$i) {
$c = decbin($i);
$d = strlen($c);
$e = $count - $d;
$f = '';
if ($count > $d) {
for ($j = 0; $j < $e; ++$j) {
$f .= '0';
}
}
$f .= $c;
$str_arr[] = $f;
}
foreach ($str_arr as $v) {
$h = '';
for ($i = 0; $i < $count; ++$i) {
$h .= $a[$i][$b[$v[$i]]];
}
echo $h,'<br/>';
}
执行结果: