📜  对角线打印矩阵和颜色 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:38.992000             🧑  作者: Mango

代码示例2
$no=9;
echo "
"; echo ""; for ($row=1; $row<=8 ; $row++) { $no--; echo ""; for ($col=1; $col<=8; $col++) { $color=""; if ($row==$col) { $color = 'background-color:red'; } if ($col==$no) { $color = 'background-color:green'; } echo ""; } echo ""; } echo "
".$row*$col."
"; echo "
";