-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise2.php
More file actions
32 lines (29 loc) · 1.4 KB
/
exercise2.php
File metadata and controls
32 lines (29 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
$countries = array(
"France" => ["capital" => "Paris", "population" => 65687541],
"Italy" => ["capital" => "Rome", "population" => 9879055],
"Luxembourg" => ["capital" => "Luxembourg", "population" => 300],
"Belgium" => ["capital" => "Brussels", "population" => 9849849],
"Denmark" => ["capital" => "Copenhagen", "population" => 8789797],
"Finland" => ["capital" => "Helsinki", "population" => 2989897],
"Slovakia" => ["capital" => "Bratislava", "population" => 3879879],
"Slovenia" => ["capital" => "Ljubljana", "population" => 64988],
"Germany" => ["capital" => "Berlin", "population" => 3965987],
"Greece" => ["capital" => "Athens", "population" => 4897987],
"Ireland" => ["capital" => "Dublin", "population" => 1987497],
"Netherlands" => ["capital" => "Amsterdam", "population" => 6897987],
"Portugal" => ["capital" => "Lisbon", "population" => 7997978],
"Spain" => ["capital" => "Madrid", "population" => 13277854],
"Sweden" => ["capital" => "Stockholm", "population" => 897982],
);
/* foreach ($countries as $key => $value) {
echo $key, $value['capital'];
}
echo '<br>'; */
ksort($countries);
foreach ($countries as $key => $value) {
echo $key . '<br>';
echo $value['capital']. '<br>';
echo $value['population']. '<br>';
echo '<br>-----------------------------------------<br>';
}