<?php
$marks = array(
array(
'name'=>'Петров',
'subjects'=>array(
'math'=>4,
'physics'=>3,
'chemistry'=>3,
'russian'=>5
),
),
array(
'name'=>'Иванов',
'subjects'=>array(
'math'=>4,
'physics'=>5,
'chemistry'=>4,
'russian'=>5
),
),
array(
'name'=>'Сидоров',
'subjects'=>array(
'math'=>5,
'physics'=>3,
'chemistry'=>4,
'russian'=>3
),
),
array(
'name'=>'Ветрова',
'subjects'=>array(
'math'=>2,
'physics'=>3,
'chemistry'=>3,
'russian'=>4
),
),
array('name'=>'Филатова',
'subjects'=>array(
'math'=>4,
'physics'=>4,
'chemistry'=>4,
'russian'=>5
),
),
array(
'name'=>'Бубнов',
'subjects'=>array(
'math'=>4,
'physics'=>3,
'chemistry'=>3,
'russian'=>4
),
),
array(
'name'=>'Пескова',
'subjects'=>array(
'math'=>5,
'physics'=>5,
'chemistry'=>4,
'russian'=>2
),
),
array(
'name'=>'Ленинов',
'subjects'=>array(
'math'=>4,
'physics'=>3,
'chemistry'=>3,
'russian'=>5
),
),
);
?>
<table>
<thead>
<tr>
<td>ФИО / Предметы</td>
<td>математика</td>
<td>физика</td>
<td>химия</td>
<td>русский</td>
<td>средний бал</td>
</tr>
</thead>
<tbody>
<?php
foreach ($marks as $student)
{
echo '<tr>
<td>'.$student['name'].'</td>
<td>'.$student['subjects']['math'].'</td>
<td>'.$student['subjects']['physics'].'</td>
<td>'.$student['subjects']['chemistry'].'</td>
<td>'.$student['subjects']['russian'].'</td>
<td>'.(($student['subjects']['math']+$student['subjects']['physics']+$student['subjects']['chemistry']+$student['subjects']['russian'])/4).'</td>
</tr>';
}
?>
</tbody>
</table>