<!DOCTYPE html>
<html>
<body>
<table>
<tr>
  		<td>Nome</td>
      <td>Voto</td>
</tr>
<?php
$voti = ["Piero" => 3, "Paolo" => 9, "Luca" => 7, "Roberto" => 3];
$media = 0;
foreach ($voti as $name => $voto) {
    $media += $voto;
    echo "<tr>
  		   <td>$name</td>
         <td>$voto</td>
        </tr>";
}
$media = $media / count($voti);
?>
</table>

<?php echo $media; ?>
</body>
</html>
