if ($Country == $key){ #get the key of country name $CountryName = $CountryCode($key); #assign the key value to a variable }