我正在尝试构建一个 az, 0-9 的数组,每个数组都有一个相同数组的子集。
IE:
array(
"a"=>array("a","b","c"..."0","1","2")
"b"=>array("a","b","c"..."0","1","2")
"c"=>array("a","b","c"..."0","1","2")
"d"=>array("a","b","c"..."0","1","2")
"0"=>array("a","b","c"..."0","1","2")
"1"=>array("a","b","c"..."0","1","2")
"2"=>array("a","b","c"..."0","1","2")
"3"=>array("a","b","c"..."0","1","2")
)
我在哪里尝试这个
$finalArr = array();
$letterArr = range('a', 'z');
$numericArr = range(0,9);
$startArr = array_merge($letterArr, $numericArr);
foreach($startArr as $key => $val)
{
$finalArr[$val] = $startArr;
foreach($finalArr[$val] as $key2 => $val2)
{
$finalArr[$val][$val2] = $startArr;
}
}
但它只适用于第一遍......之后它开始变得一团糟。有任何想法吗?