" . "九九乘法表"; for ($i = 1; $i <= $rows; $i++) { $table .= ""; for ($j = 1; $j <= $cols; $j++) { if ($i == $j) { $table .= ($i % 3 == 0) ? "" : ""; } else if ($i % 3 == 0 || $j % 3 == 0) { $table .= ""; } else { $table .= ""; } $table .= $i . " * " . $j . " = " . $i * $j . ""; } $table .= ""; } $table .= ""; return $table; } echo set_table(9, 9); ?>