1
birnet
How to get Country name by id
  • 2013/5/16 12:27

  • birnet

  • Just popping in

  • Posts: 5

  • Since: 2013/1/4 2


hi ^^
i want to know How to get Country name by id:
For example:
Morocco = MA

how to get the name of this country by using the country code ( MA )
Any function do this?

Thanks

2
zyspec
Re: How to get Country name by id
  • 2013/5/16 13:36

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


You can do it something like this:

$findThis mb_strtoupper("MA");

$countryArray Xoopslists::getCountryList();
$countryName = (array_key_exists($findThis$countryArray)) ? $countryArray[$findThis] : "Unknown country code";

echo 
"Country code {$findThis} is: {$countryName}";


Which should display:

Quote:

Country code MA is : Morocco

3
birnet
Re: How to get Country name by id
  • 2013/5/16 14:22

  • birnet

  • Just popping in

  • Posts: 5

  • Since: 2013/1/4 2


thank you verry much ^^

Login

Who's Online

197 user(s) are online (121 user(s) are browsing Support Forums)


Members: 0


Guests: 197


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits