I’m trying to convert a two letter language abbreviations to full words using str_replace.
The problem I’m having is that they’re affecting each other when echoed out.
$lang = str_replace("en", "English", $lang);
$lang = str_replace("es", "Spanish", $lang);
$lang = str_replace("pt", "Portuguese", $lang);
$lang = str_replace("fr", "French", $lang);
$lang = str_replace("de", "German", $lang);
$lang = str_replace("it", "Italian", $lang);
$lang = str_replace("pl", "Polish", $lang);
$lang = str_replace("ru", "Russian", $lang);
$lang = str_replace("sv", "Spanish (El Salvador)", $lang);
$lang = str_replace("ko", "Korean", $lang);
$lang = str_replace("zh", "Chinese", $lang);
$lang = str_replace("nl", "Dutch", $lang);
An example: when I echo out en, I get EnglIcelandich.
The list above is bigger but that is just a example. I have tried renaming the vars but with no luck.
It’s simple! Use
strtrinstead.