l101/opdrachten/H10/10.3.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 $fruitschaal = []; $fruitschaal['Appel'] = 'Rood'; $fruitschaal['Aardbei'] = 'Rood'; $fruitschaal['Banaan'] = 'Geel'; $fruitschaal['Mango'] = 'Geel'; $fruitschaal['Watermeloen'] = 'Groen'; $fruitschaal['Kiwi'] = 'Groen'; krsort($fruitschaal); foreach($fruitschaal as $fruit => $kleur){ echo "<div>De kleur van $fruit is $kleur</div>"; } ?> </body> </html>

Resultaat

Made by Thijs Aarnoudse