如何开始位置为 1 而不是 0?
因为名字从 0 开始。我需要做的就是让名字从 1 开始,以 50 结束。
有没有办法解决这个问题?
这是我的代码:
<html>
<head>
<title>SEATPLAN</title>
</head>
<body>
<table border = "2" cellpadding = "20" cellspacing = "10">
<tr>
<td colspan = 5 rowspan = 2> </td>
<td align = "center"> Teachers Table</td>
<td colspan = 5 rowspan = 2> </td>
</tr>
<tr>
<td colspan = 1 rowspan = 6 width="1000"> </td>
</tr>
<?php
$names = array('Acog','Alaya-ay','Anino','Balsa','Baron','Borda','Bravo','Dalagan','Detumal','Enriquez',
'Hernane','Jose','Laminero','Montilla','Moraclo','Ogang','Palencia','Palencia','Pandili',
'Ramo','Ravelo','Septio','Tapel','Tayone','Trinidad','Yntong','Student','Student','Student',
'Student','Student','Student','Student','Student','Student','Student','Student','Student',
'Student','Student','Student','Student','Student','Student','Student','Student','Student'
,'Student','Student','Student');
?>
<?php
foreach($names as $position => $name){
echo "<td width='500' align='center'>".$position."<br>".$name."<br/>";
if ($position == 9){
echo "<tr width='500' align='center'>"."<br/>";}
if ($position == 19){
echo "<tr width='500' align='center'>"."<br/>";}
if ($position == 29){
echo "<tr width='500' align='center'>"."<br/>";}
if ($position == 39){
echo "<tr width='500' align='center'>"."<br/>";}
}
?>
</table>
</body>
</html>