Using PHP how can I convert this string variable into another form? -
i have huge list of city, country
want display them in compact form of country.
so example have following variable
hallands, sweden
but how can show here meaning after , , space
keep 2 letters , capitalize.
hallands, sw ?
then try this
$str='hallands, sweden'; $str=explode(',',str); echo $str[0].','.strtoupper(substr($str[1], 0, 2));
Comments
Post a Comment