Right now I am using this function for emoticons:
function emoticons($text) { $icons = array( \':)\' => \'
I think using regular expressions instead of just defining your emoticons. This could look like
// replaces a :) when it is surrounded by whitespaces return preg_replace('/\s:)\s/', '', $text);