2 回答
TA贡献1845条经验 获得超8个赞
您的数组引用是错误的。对于一个简单的数组,当使用 foreach 时,$key几乎无关紧要,因为该出现的值将在$firstor中$second......
foreach($a as $first){
foreach($b as $second){
foreach($c as $third){
echo $first . $second . $third . PHP_EOL;
}
}
}
如果您在浏览器上输出此内容,请更改PHP_EOL为'<br>'
TA贡献1998条经验 获得超6个赞
你差不多解决了。你不需要在这里使用密钥。这是代码
<?php
$a = array("0","1","2","3","4","5","6","7","8","9");
$b = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
$c = array("0","1","2","3","4","5","6","7","8","9");
foreach($a as $first){
foreach($b as $second){
foreach($c as $third){
echo ($first.$second.$third).PHP_EOL;
}
}
}
- 2 回答
- 0 关注
- 90 浏览
添加回答
举报