x111/D2.php

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <?php $hoofdsteden = array('Amsterdam' => 'Nederland','Brussel' => 'België', 'Parijs' => 'Frankrijk', 'Madrid' => 'Spanje'); echo "<table border = '1'>"; echo "<tr><th>Nummer</th><th>Hoofdstad</th><th>Land</th></tr>"; $nummer = 1; foreach ($hoofdsteden as $hoofdstad => $land){ echo "<tr><td>$nummer</td><td>$hoofdstad</td><td>$land</td></tr>"; $nummer ++; } echo "</table>"; ?> </body> </html>

Resultaat

Made by Thijs Aarnoudse