I have an array containing country codes and country names. I need to echo a country from the array.
I have the country code which works as the key of the array:
AG
When I do a var_dump
var_dump($country_list);
I receive the following:
array(224) { [""]=> string(19) "Select a country..." ["AF"]=> string(11) "Afghanistan" ["AL"]=> string(7) "Albania" ["DZ"]=> string(7) "Algeria" ["AD"]=> string(7) "Andorra" ["AO"]=> string(6) "Angola" ["AI"]=> string(8) "Anguilla" ["AQ"]=> string(10) "Antarctica" ["AG"]=> string(19) "Antigua and Barbuda" ["AR"]=> string(9) "Argentina" ["AM"]=> string(7) "Armenia" ["AW"]=> string(5) "Aruba" ["AU"]=> string(9) "Australia" ["AT"]=> string(7) "Austria" ["AZ"]=> string(10) "Azerbaijan" ["BS"]=> string(7) "Bahamas" ["BH"]=> string(7) "Bahrain" ["BD"]=> string(10) "Bangladesh" ["BB"]=> string(8) "Barbados" ["BY"]=> string(7) "Belarus" ["BE"]=> string(7) "Belgium" ["BZ"]=> string(6) "Belize" ["BJ"]=> string(5) "Benin" ....
How can I echo the country name where the country code is: AG
It may seem simple to some but I am having difficulties.
You can just simple echo it