Re: Replace text

From: Date: Sun, 28 Oct 2001 00:20:51 +0000
Subject: Re: Replace text
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-72597@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?? :) =do you really want those quotation marks in the str_replace function call? =dn

« previous php.general (#72597) next »