Is there a way to convert country name to country code abbreviation? Or some php function?
So that when its “Australia” it will be changed to “AU”
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
PHP itself has no knowledge of these values. You have to create your own code:
Method 1:
Create an array like:
After that, just use the pre0stored values:
Method 2 ( suggested ):
Store the values into DB:
And Access with simple query:
EDIT