So I have this JSON array:
$countryCodes = json_decode("{
"Codes": [
{"Code":"AD","Country":"Andorra"},
{"Code":"AE","Country":"United Arab Emirates (الإمارات العربيّة المتّحدة)"},
{"Code":"AF","Country":"Afghanistan (افغانستان)"},
{"Code":"AG","Country":"Antigua and Barbuda"},
{"Code":"AI","Country":"Anguilla"},
{"Code":"AL","Country":"Albania (Shqipëria)"},
{"Code":"AM","Country":"Armenia (Հայաստան)"},
{"Code":"AO","Country":"Angola"},
{"Code":"AQ","Country":"Antarctica"},
{"Code":"AR","Country":"Argentina"},
{"Code":"AS","Country":"American Samoa"},
{"Code":"AT","Country":"Austria (Österreich)"},
{"Code":"AU","Country":"Australia"},
{"Code":"AW","Country":"Aruba"},
{"Code":"AX","Country":"Aland Islands"},
{"Code":"AZ","Country":"Azerbaijan (Azərbaycan)"},
{"Code":"BA","Country":"Bosnia and Herzegovina (Bosna i Hercegovina)"},
{"Code":"BB","Country":"Barbados"},
{"Code":"BD","Country":"Bangladesh (বাংলাদেশ)"},
{"Code":"BE","Country":"Belgium (België)"},
{"Code":"BF","Country":"Burkina Faso"},
{"Code":"BG","Country":"Bulgaria (България)"},
{"Code":"BH","Country":"Bahrain (البحرين)"},
{"Code":"BI","Country":"Burundi (Uburundi)"},
{"Code":"BJ","Country":"Benin (Bénin)"},
{"Code":"BL","Country":"Saint Barthélemy"},
{"Code":"BM","Country":"Bermuda"},
{"Code":"BN","Country":"Brunei (Brunei Darussalam)"},
{"Code":"BO","Country":"Bolivia, Plurinational State of"},
{"Code":"BQ","Country":"Bonaire, Sint Eustatius and Saba"},
{"Code":"BR","Country":"Brazil (Brasil)"},
{"Code":"BS","Country":"Bahamas"},
{"Code":"BT","Country":"Bhutan (འབྲུག་ཡུལ)"},
{"Code":"BV","Country":"Bouvet Island"},
{"Code":"BW","Country":"Botswana"},
{"Code":"BY","Country":"Belarus (Белару́сь)"},
{"Code":"BZ","Country":"Belize"},
{"Code":"CA","Country":"Canada"},
{"Code":"CC","Country":"Cocos (Keeling) Islands"},
{"Code":"CD","Country":"Congo, Democratic Republic of the"},
{"Code":"CF","Country":"Central African Republic (République Centrafricaine)"},
{"Code":"CG","Country":"Congo"},
{"Code":"CH","Country":"Switzerland (Schweiz)"},
{"Code":"CI","Country":"Côte d'Ivoire"},
{"Code":"CK","Country":"Cook Islands"},
{"Code":"CL","Country":"Chile"},
{"Code":"CM","Country":"Cameroon (Cameroun)"},
{"Code":"CN","Country":"China (中国)"},
{"Code":"CO","Country":"Colombia"},
{"Code":"CR","Country":"Costa Rica"},
{"Code":"CU","Country":"Cuba"},
{"Code":"CV","Country":"Cape Verde (Cabo Verde)"},
{"Code":"CW","Country":"Curaçao"},
{"Code":"CX","Country":"Christmas Island"},
{"Code":"CY","Country":"Cyprus (Κυπρος)"},
{"Code":"CZ","Country":"Czech Republic (Česko)"},
{"Code":"DE","Country":"Germany (Deutschland)"},
{"Code":"DJ","Country":"Djibouti"},
{"Code":"DK","Country":"Denmark (Danmark)"},
{"Code":"DM","Country":"Dominica"},
{"Code":"DO","Country":"Dominican Republic"},
{"Code":"DZ","Country":"Algeria (الجزائر)"},
{"Code":"EC","Country":"Ecuador"},
{"Code":"EE","Country":"Estonia (Eesti)"},
{"Code":"EG","Country":"Egypt (مصر)"},
{"Code":"EH","Country":"Western Sahara (الصحراء الغربية)"},
{"Code":"ER","Country":"Eritrea (Ertra)"},
{"Code":"ES","Country":"Spain (España)"},
{"Code":"ET","Country":"Ethiopia (Ityop'iya)"},
{"Code":"FI","Country":"Finland (Suomi)"},
{"Code":"FJ","Country":"Fiji"},
{"Code":"FK","Country":"Falkland Islands"},
{"Code":"FM","Country":"Micronesia"},
{"Code":"FO","Country":"Faroe Islands"},
{"Code":"FR","Country":"France"},
{"Code":"GA","Country":"Gabon"},
{"Code":"GB","Country":"United Kingdom"},
{"Code":"GD","Country":"Grenada"},
{"Code":"GE","Country":"Georgia (საქართველო)"},
{"Code":"GF","Country":"French Guiana"},
{"Code":"GG","Country":"Guernsey"},
{"Code":"GH","Country":"Ghana"},
{"Code":"GI","Country":"Gibraltar"},
{"Code":"GL","Country":"Greenland"},
{"Code":"GM","Country":"Gambia"},
{"Code":"GN","Country":"Guinea (Guinée)"},
{"Code":"GP","Country":"Guadeloupe"},
{"Code":"GQ","Country":"Equatorial Guinea (Guinea Ecuatorial)"},
{"Code":"GR","Country":"Greece (Ελλάς)"},
{"Code":"GS","Country":"South Georgia and the South Sandwich Islands"},
{"Code":"GT","Country":"Guatemala"},
{"Code":"GU","Country":"Guam"},
{"Code":"GW","Country":"Guinea-Bissau (Guiné-Bissau)"},
{"Code":"GY","Country":"Guyana"},
{"Code":"HK","Country":"Hong Kong"},
{"Code":"HM","Country":"Heard Island and McDonald Islands"},
{"Code":"HN","Country":"Honduras"},
{"Code":"HR","Country":"Croatia (Hrvatska)"},
{"Code":"HT","Country":"Haiti (Haïti)"},
{"Code":"HU","Country":"Hungary (Magyarország)"},
{"Code":"ID","Country":"Indonesia"},
{"Code":"IE","Country":"Ireland"},
{"Code":"IL","Country":"Israel (ישראל)"},
{"Code":"IM","Country":"Isle of Man"},
{"Code":"IN","Country":"India"},
{"Code":"IO","Country":"British Indian Ocean Territory"},
{"Code":"IQ","Country":"Iraq (العراق)"},
{"Code":"IR","Country":"Iran, Islamic Republic of (جمهوری اسلامی ایران)"},
{"Code":"IS","Country":"Iceland (Ísland)"},
{"Code":"IT","Country":"Italy (Italia)"},
{"Code":"JE","Country":"Jersey"},
{"Code":"JM","Country":"Jamaica"},
{"Code":"JO","Country":"Jordan (الاردن)"},
{"Code":"JP","Country":"Japan (日本)"},
{"Code":"KE","Country":"Kenya"},
{"Code":"KG","Country":"Kyrgyzstan (Кыргызстан)"},
{"Code":"KH","Country":"Cambodia (Kampuchea)"},
{"Code":"KI","Country":"Kiribati"},
{"Code":"KM","Country":"Comoros (Comores)"},
{"Code":"KN","Country":"Saint Kitts and Nevis"},
{"Code":"KP","Country":"Korea, (North) Democratic People’s Republic of (조선민주주의인민공화국)"},
{"Code":"KR","Country":"Korea, (South) Republic of (대한민국)"},
{"Code":"KW","Country":"Kuwait (الكويت)"},
{"Code":"KY","Country":"Cayman Islands"},
{"Code":"KZ","Country":"Kazakhstan (Қазақстан)"},
{"Code":"LA","Country":"Lao People’s Democratic Republic (ສາທາລະນະລັດ ປະຊາທິປະໄຕ ປະຊາຊົນລາວ)"},
{"Code":"LB","Country":"Lebanon (لبنان)"},
{"Code":"LC","Country":"Saint Lucia"},
{"Code":"LI","Country":"Liechtenstein"},
{"Code":"LK","Country":"Sri Lanka"},
{"Code":"LR","Country":"Liberia"},
{"Code":"LS","Country":"Lesotho"},
{"Code":"LT","Country":"Lithuania (Lietuva)"},
{"Code":"LU","Country":"Luxembourg (Lëtzebuerg)"},
{"Code":"LV","Country":"Latvia (Latvija)"},
{"Code":"LY","Country":"Libya (ليبيا)"},
{"Code":"MA","Country":"Morocco (المغرب)"},
{"Code":"MC","Country":"Monaco"},
{"Code":"MD","Country":"Moldova, Republic of"},
{"Code":"ME","Country":"Montenegro (Црна Гора)"},
{"Code":"MF","Country":"Saint Martin (French part)"},
{"Code":"MG","Country":"Madagascar (Madagasikara)"},
{"Code":"MH","Country":"Marshall Islands"},
{"Code":"MK","Country":"Macedonia, the former Yugoslav Republic of (Македонија)"},
{"Code":"ML","Country":"Mali"},
{"Code":"MM","Country":"Myanmar (Burma)"},
{"Code":"MN","Country":"Mongolia (Монгол Улс)"},
{"Code":"MO","Country":"Macao"},
{"Code":"MP","Country":"Northern Mariana Islands"},
{"Code":"MQ","Country":"Martinique"},
{"Code":"MR","Country":"Mauritania (موريتانيا)"},
{"Code":"MS","Country":"Montserrat"},
{"Code":"MT","Country":"Malta"},
{"Code":"MU","Country":"Mauritius"},
{"Code":"MV","Country":"Maldives"},
{"Code":"MW","Country":"Malawi"},
{"Code":"MX","Country":"Mexico (México)"},
{"Code":"MY","Country":"Malaysia"},
{"Code":"MZ","Country":"Mozambique (Moçambique)"},
{"Code":"NA","Country":"Namibia"},
{"Code":"NC","Country":"New Caledonia"},
{"Code":"NE","Country":"Niger"},
{"Code":"NF","Country":"Norfolk Island"},
{"Code":"NG","Country":"Nigeria"},
{"Code":"NI","Country":"Nicaragua"},
{"Code":"NL","Country":"Netherlands (Nederland)"},
{"Code":"NO","Country":"Norway (Norge)"},
{"Code":"NP","Country":"Nepal (नेपाल)"},
{"Code":"NR","Country":"Nauru (Naoero)"},
{"Code":"NU","Country":"Niue"},
{"Code":"NZ","Country":"New Zealand"},
{"Code":"OM","Country":"Oman (عمان)"},
{"Code":"PA","Country":"Panama (Panamá)"},
{"Code":"PE","Country":"Peru (Perú)"},
{"Code":"PF","Country":"French Polynesia"},
{"Code":"PG","Country":"Papua New Guinea"},
{"Code":"PH","Country":"Philippines (Pilipinas)"},
{"Code":"PK","Country":"Pakistan (پاکستان)"},
{"Code":"PL","Country":"Poland (Polska)"},
{"Code":"PM","Country":"Saint Pierre and Miquelon"},
{"Code":"PN","Country":"Pitcairn"},
{"Code":"PR","Country":"Puerto Rico"},
{"Code":"PS","Country":"Palestine, State of"},
{"Code":"PT","Country":"Portugal"},
{"Code":"PW","Country":"Palau (Belau)"},
{"Code":"PY","Country":"Paraguay"},
{"Code":"QA","Country":"Qatar (قطر)"},
{"Code":"RE","Country":"Réunion"},
{"Code":"RO","Country":"Romania (România)"},
{"Code":"RS","Country":"Serbia (Србија)"},
{"Code":"RU","Country":"Russian Federation (Россия)"},
{"Code":"RW","Country":"Rwanda"},
{"Code":"SA","Country":"Saudi Arabia (المملكة العربية السعودية)"},
{"Code":"SB","Country":"Solomon Islands"},
{"Code":"SC","Country":"Seychelles"},
{"Code":"SD","Country":"Sudan (السودان)"},
{"Code":"SE","Country":"Sweden (Sverige)"},
{"Code":"SG","Country":"Singapore (Singapura)"},
{"Code":"SH","Country":"Saint Helena, Ascension and Tristan da Cunha"},
{"Code":"SI","Country":"Slovenia (Slovenija)"},
{"Code":"SJ","Country":"Svalbard and Jan Mayen"},
{"Code":"SK","Country":"Slovakia (Slovensko)"},
{"Code":"SL","Country":"Sierra Leone"},
{"Code":"SM","Country":"San Marino"},
{"Code":"SN","Country":"Senegal (Sénégal)"},
{"Code":"SO","Country":"Somalia (Soomaaliya)"},
{"Code":"SR","Country":"Suriname"},
{"Code":"SS","Country":"South Sudan"},
{"Code":"ST","Country":"São Tomé and Príncipe"},
{"Code":"SV","Country":"El Salvador"},
{"Code":"SX","Country":"Sint Maarten (Dutch part)"},
{"Code":"SY","Country":"Syrian Arab Republic (سوريا)"},
{"Code":"SZ","Country":"Swaziland"},
{"Code":"TC","Country":"Turks and Caicos Islands"},
{"Code":"TD","Country":"Chad (Tchad)"},
{"Code":"TF","Country":"French Southern Territories"},
{"Code":"TG","Country":"Togo"},
{"Code":"TH","Country":"Thailand (ราชอาณาจักรไทย)"},
{"Code":"TJ","Country":"Tajikistan (Тоҷикистон)"},
{"Code":"TK","Country":"Tokelau"},
{"Code":"TL","Country":"Timor-Leste"},
{"Code":"TM","Country":"Turkmenistan (Türkmenistan)"},
{"Code":"TN","Country":"Tunisia (تونس)"},
{"Code":"TO","Country":"Tonga"},
{"Code":"TR","Country":"Turkey (Türkiye)"},
{"Code":"TT","Country":"Trinidad and Tobago"},
{"Code":"TV","Country":"Tuvalu"},
{"Code":"TW","Country":"Taiwan, Province of Chine (台灣)"},
{"Code":"TZ","Country":"Tanzania, United Republic of"},
{"Code":"UA","Country":"Ukraine (Україна)"},
{"Code":"UG","Country":"Uganda"},
{"Code":"UM","Country":"United States minor outlying islands"},
{"Code":"US","Country":"United States"},
{"Code":"UY","Country":"Uruguay"},
{"Code":"UZ","Country":"Uzbekistan (O‘zbekiston)"},
{"Code":"VA","Country":"Vatican City (Città del Vaticano)"},
{"Code":"VC","Country":"Saint Vincent and the Grenadines"},
{"Code":"VE","Country":"Venezuela, Bolivarian Republic of"},
{"Code":"VG","Country":"Virgin Islands, British"},
{"Code":"VI","Country":"Virgin Islands, U.S."},
{"Code":"VN","Country":"Vietnam (Việt Nam)"},
{"Code":"VU","Country":"Vanuatu"},
{"Code":"WF","Country":"Wallis and Futuna"},
{"Code":"WS","Country":"Samoa"},
{"Code":"YE","Country":"Yemen (اليمن)"},
{"Code":"YT","Country":"Mayotte"},
{"Code":"ZA","Country":"South Africa"},
{"Code":"ZM","Country":"Zambia"},
{"Code":"ZW","Country":"Zimbabwe"}
]
}");
When I try to echo a Country with it's Code, it doesn't work:
echo $countryCodes->Codes->Code['AO'];
I don't think I understand the proper method to do this, how can I display the Country Name by searching the JSON with the Country Code?