Re: Replace text

From: Date: Sat, 27 Oct 2001 11:26:43 +0000
Subject: Re: Replace text
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-72556@lists.php.net to get a copy of this message
What if pass some parameters to function - i mean not use global $comment but do like function replace_text_smiley($comment) ----- Original Message ----- From: "Daniel Harik" <gatop@hot.ee> To: <php-general@lists.php.net> Sent: Sunday, October 28, 2001 12:20 AM Subject: [PHP] Replace text > 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 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#72556) next »