The code is:
print 'start
';
$f = file_get_contents("countryinfo.xml");
preg_match_all("/.*<\/countryCode>/i",$f,$str);
preg_match_all("/.*<\/countryName>/i",$f,$str1);
$country_names = array();
for ($i=0;$i<15;$i++){
$country_names[strtolower($str[0][$i])] = $str1[0][$i];
}
print 'Array $country_names is:
';
print_r($country_names);
print '
Print command is:
';
print '"AD ->".$country_names["ad"]
';
print 'Error is:
';
print 'AD ->'.$country_names['ad'];
The output is:
start
Array $country_names is:
Array ( [ad] => Andorra [af] => Afghanistan [ag] => Antigua and Barbuda [ai] => Anguilla [al] => Albania [am] => Armenia [an] => Netherlands Antilles [ao] => Angola [aq] => Antarctica [ar] => Argentina [as] => American Samoa [at] => Austria [au] => Australia [aw] => Aruba [az] => Azerbaijan )
Print command is:
"AD ->".$country_names["ad"]
Error is:
Notice: Undefined index: ad in /var/www/apache2/html/giscover2/export_db.php on line 88 AD ->