tengo la siguiente tabla, que esta generada en excel y la tengo que programar con PHP.

(http://desmond.110mb.com/tabla.jpg)
Tengo el siguiente codigo:
Código PHP:
$cuota_mes = 661.66;
$monto = 11188;
$interes_mes_1 = $monto*(8/1200);
$amortizacion_mes_1 = $cuota_mes - $interes_mes_1;
$acumulada_mes_1 = $amortizacion_mes_1;
$pendiente_mes_1 = $monto - $amortizacion_mes_1;
$meses = 18;
echo "<table border='1'>";
echo "<tr>";
echo "<td width='120' align='center' rowspan='2'>Numero</td>";
echo "<td width='120' align='center' rowspan='2'>Amortización Mes</td>";
echo "<td width='80' align='center' rowspan='2'>Interes Mes</td>";
echo "<td width='80' align='center' rowspan='2'>Total Mes</td>";
echo "<td colspan='2' align='center'>Amortización</td>";
echo "<tr>";
echo "<td width='80' align='center'>Acumulada</td>";
echo "<td width='80' align='center'>Pendiente</td>";
echo "</tr>";
echo "</tr>";
echo "<tr>";
for($x=1;$x<=5;$x++)
{
$interes_mes_1 = $monto*(8/1200);
$amortizacion_mes_1 = $cuota_mes - $interes_mes_1;
$acumulada_mes_1 = $amortizacion_mes_1;
$pendiente_mes_1 = $monto - $amortizacion_mes_1;
echo "<td>".$x."</td>";
echo "<td>".number_format($amortizacion_mes_1,2)."</td>";
echo "<td>".number_format($interes_mes_1,2)."</td>";
echo "<td>".number_format($cuota_mes,2)."</td>";
echo "<td>".number_format($acumulada_mes_1,2)."</td>";
echo "<td>".number_format($pendiente_mes_1,2)."</td>";
echo "<tr>";
for ($y=1;$y<=2;$y++)
{
$interes_mes_2 = $pendiente_mes_1 * (8/1200);
$amortizacion_mes_2 = $cuota_mes - $interes_mes_2;
$acumulada_mes_2 = $amortizacion_mes_1 + $amortizacion_mes_2;
$pendiente_mes_2 = $pendiente_mes_1 - $amortizacion_mes_2;
echo "<td></td>";
echo "<td>".number_format($amortizacion_mes_2,2)."</td>";
echo "<td>".number_format($interes_mes_2,2)."</td>";
echo "<td>".number_format($cuota_mes,2)."</td>";
echo "<td>".number_format($acumulada_mes_2,2)."</td>";
echo "<td>".number_format($pendiente_mes_2,2)."</td>";
echo "</tr>";
}
echo "</tr>";
}
echo "</tr>";
echo "</table>"
Código PHP:
echo $pendiente_mes_2;
esta bien que use los for? o debo usar otro bucle? o como puedo hacer para generar esto?
les agradeceria mucho la ayuda que puedan darme, gracias.
ahh me olvidaba, tendria que ser para 18 filas o meses como para 5 o para 30 etc, dependiendo del usuario. osea el x<=$meses.