Replace text

From: Date: Sat, 27 Oct 2001 21:18:29 +0000
Subject: Replace text
Groups: php.general 
Request: Send a blank email to php-general+get-72553@lists.php.net to get a copy of this message
Hello guys function replace_text_smiley(){ global $comment; // To add a relation between a text smiley a an image smiley do this: // $faces["text smiley here"] = "img tag to image smile here"; $faces[":)"] = "<IMG SRC=\"emoticons/smile.gif\">"; $faces[":P"] = "<IMG SRC=\"emoticons/tongue.gif\">"; $faces[":D"] = "<IMG SRC=\"emoticons/happy.gif\">"; $faces[":("] = "<IMG SRC=\"emoticons/mad.gif\">"; $faces[";)"] = "<IMG SRC=\"emoticons/wink.gif\">"; while(list($text,$image) = each($faces)) { $comment = str_replace("$text","$image","$comment"); } return $comment; } this function replaces faces to smilies images then in a separete file i use this function and another one to replace urls... the url replacement is ok but it doesn't change the text to smilies.. any guesses?? :) Thnx in advance

« previous php.general (#72553) next »