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
|
<html>
<head>
<title> Multidimensional arrays</title>
<style type="text/css" title="text/css" media="all">
.error {
fon-weight: bold;
color: #C00
}
</style>
</head>
<body>
<p> Some North american States, provinces, and territories : </p>
<?php
$mexico=array('YU'=>'Yucatan', 'BC'=>'Baja California', 'OA'=>'Oaxaca');
$us=array('MD'=>'Maryland', 'IL'=>'Illinois', 'PA'=>'Pennsylvania', 'IA'=>'Iowa');
$canada=array('QC'=>'Quebec', 'AB'=>'Alberta', 'NT'=>'Northwest territories', 'YT'=>'Yukon', 'PE'=>'prince Edward Island');
$n_amarica=array('Mexico'=>'$mexico', 'United States'=>'$us', 'Canada'=>'$canada');
foreach ($n_amarica as $country => $list){
echo "<h2>$country</h2><u1>";
foreach ($list as $k => $v){
echo "$k - $v";
}
echo '<u1>';
}
?>
</body>
</html> |
Partager