<?php
/* array declaration */
$countries = array ("Nepal" => array("population" => "11,353,140", "capital" => "Kathmandu"),
"India" => array("population" => "1,711,263", "capital" => "Delhi"));
/* display all the countries */
echo "Display all districts <br />";
foreach ($countries AS $country) {
vprintf("<p>Population: %s<br />Capital: %s", $country);
}
echo "<br /> <br />Display one country <br />";
/* display one*/
echo $countries["Nepal"]["population"];
?>
Categories:
PHP