<?php
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE); //显示除去E_WARNING E_NOTICE 之外的所有错误信息
$arr[0] = array(1, 2,3);
$arr[1] = array(4, 5,6,7);
//$arr[2] = array(7, 8);
//$arr[3] = array(10, 11, 12);
//$arr[4] = array("a", "b", "c");
//$arr[5] = array("a", "b", "c");
//$arr[6] = array("a", "b", "c");
//$arr[7] = array("a", "b", "c");
//$arr[8] = array("a", "b", "c");
$data=$arr;
$prefix_data = array_shift($data);
$index = array();
$output = array();
$total = 1;
foreach ($data as $row) {
$total = $total * count($row);
}
//echo $total;
for ($i = 0; $i < $total; $i ++) {
$depth_product = 1;
foreach ($data as $j => $row) {
$bound = count($row);
// echo $bound;
$index[$i][$j] = isset($index[$i - 1][$j]) ? $index[$i - 1][$j] : 0;
echo $i;
if ($i > 0 && $i % $depth_product == 0) {
$index[$i][$j] ++;
}
echo $index[$i][$j]."<br>";
$output[$i][$j] = $row[$index[$i][$j] % $bound];
$depth_product = $depth_product * $bound;
}
}
//print_r($output);
foreach ($prefix_data as $char) {
foreach ($output as $row) {
echo $char . implode($row) . "<br>";
}
}
?>