You can use strtr
for such purposes. I do not know what problems you have to solve with smileys etc, so I'll give you an example for German umlauts (however not to HTML entities, but to standard ASCII characters):
$string = strtr($string, array('ä' => 'ae', 'ö' => 'oe', 'ü' => 'ue'));
Of course you can also use HTML entities instead of ae
etc, you just have to look them up.
Edit
Judging from your update (I want make input where smiles like :-) will change to image. Or my interpunctioned characters to html code.) I think you want to use both htmlentities
and strtr
.
htmlentities
will make sure that all non-ASCII characters are displayed correctly. Also have a look at UTF-8. With UTF-8, you will not have to translate your czech characters.
And strtr
will replace your smileys by the proper HTML code.