Oct 24, 2001 #1 Naits Programmer Joined Oct 10, 2001 Messages 90 Location NO How can i find text in an variable an replace it with some other text like: $text ="Hello " //and replace with <img src="myserver/smilies/smile.gif">
How can i find text in an variable an replace it with some other text like: $text ="Hello " //and replace with <img src="myserver/smilies/smile.gif">
Oct 24, 2001 #2 stakadush Programmer Joined Oct 1, 2001 Messages 195 Location IL you need to use regular expressions. something like this: Code: $text ="Hello :)"; //and replace :) with $text = ereg_replace (":)", " <img src=\"myserver/smilies/smile.gif\">", $text); to read more about it go to: http://www.php.net/ereg_replace (-: Upvote 0 Downvote
you need to use regular expressions. something like this: Code: $text ="Hello :)"; //and replace :) with $text = ereg_replace (":)", " <img src=\"myserver/smilies/smile.gif\">", $text); to read more about it go to: http://www.php.net/ereg_replace (-:
Oct 24, 2001 #3 Glowball Programmer Joined Oct 6, 2001 Messages 373 Location US stakadush, why regular expressions? The following should work: Code: $text = str_replace(":)", "<img src='myserver/smilies/smile.gif'>", "Hello :)"); No? Should cut down on processing that way too. Upvote 0 Downvote
stakadush, why regular expressions? The following should work: Code: $text = str_replace(":)", "<img src='myserver/smilies/smile.gif'>", "Hello :)"); No? Should cut down on processing that way too.
Oct 25, 2001 #4 stakadush Programmer Joined Oct 1, 2001 Messages 195 Location IL didn't think of that. (-: Upvote 0 Downvote
Oct 25, 2001 Thread starter #5 Naits Programmer Joined Oct 10, 2001 Messages 90 Location NO Thanx!!! Upvote 0 Downvote