All pastes #897114 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-02-09 06:34 UTC
rendered paste body
The code is:

    print 'start<br>';
    $f = file_get_contents("countryinfo.xml");
    preg_match_all("/<countryCode>.*<\/countryCode>/i",$f,$str);
    preg_match_all("/<countryName>.*<\/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:<br>';
    print_r($country_names);
    print '<br>Print command is:<br>';
    print '"AD ->".$country_names["ad"]<br>';
    print 'Error is:<br>';
    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 ->