echo "<table border='1'>";
for($i = 1; $i <= 8; $i++){
echo "<tr>";
for($a = 1; $a <= 9; $a++){
if ($a > $i) {
echo "<td style='color: red'>*</td>";
} else {
echo "<td style='color: green'>*</td>";
}
}
echo "</tr>";
}
echo "</table>";