我有 3 个数组
$array1 = [a,b,c,d];
$array2 = [word,word1,word2,word3];
$array3 = [3,4,6,7];
和
count($array1) == count($array2) == count($array3);
我想将它们打印到 3 列的表格中。
谁能告诉我如何处理这个问题?
最佳答案
$array1 = [a,b,c,d];
$array2 = [word,word1,word2,word3];
$array3 = [3,4,6,7];
$tableStr = "<table>";
foreach ($array1 as $key => $array1Value) {
$tableStr .= "<tr><td>".$array1Value.'</td><td>'.$array2[$key].'<td></td>'.$array3[$key].'</td></tr>';
}
$tableStr .= "</table>";
echo $tableStr;
关于php - 如何在一个表中打印 3 个数组,每个数组应代表 1 列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44022222/