function replace_text_smiley(){ 
global $comment; 

$faces[":-)"] = "<img src=\"emoticons/smile.gif\">"; 
$faces[":p"] = "<img src=\"emoticons/tongue.gif\">"; 

while(list($text,$image) = each($faces)) 
{ 
$comment = str_replace("$text","$image","$comment"); 
} 

return $comment; 
}