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

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -