I am writing a php function to convert ISO 3166-1 alpha 2 codes into the country telephone code. My challenge is that when I call the function, just the + symbol shows up. How do I get the numbers too to show up? Below is the code i used, just that I've reduced the number of countries.
<?php
function ctryarray($data)
{
$redata = "";
$country['AF'] = "+93";
$country['AL'] = "+355";
$country['DZ'] = "+213";
$country['AS'] = "+1";
$redata = $country[$data];
return $redata;
}
?>
//Then I use the following code to call it:
$countrycode = ctryarray($ccode);
where $ccode is the ISO 3166-1 alpha-2 code.