PHP array to HTML select


I have a list of countries in this format in an external file:

<? $countries=array();
$countries['AS']='American Samoa';
$countries['AO']='Angola'; ?>

How can I make them list as options in a HTML select, with the abreviation (ex: 'AF') being the value and the full name of the country, the displayed text?

Ex: <option value="AF">Afghanistan</option>

Best Solution

foreach($countries as $cc => $name) {
    echo '<option value="' . $cc . '">' . $name . '</option>';

If the external file only contains the country list (btw, use <?php instead of <?!!), simply include it.