peranha Posted December 10, 2007 Share Posted December 10, 2007 Can anyone help me to convert to an image such as this website does on the posts? I input the code into my database, and would like to get the image when looking at posts, or do I have to insert img code into the database. Link to comment https://forums.phpfreaks.com/topic/81033-solved-replace-text/ Share on other sites More sharing options...
trq Posted December 10, 2007 Share Posted December 10, 2007 <?php $s = "hello:)"; echo str_replace('','<img src="smillie.jpg">',$s); ?> Link to comment https://forums.phpfreaks.com/topic/81033-solved-replace-text/#findComment-411129 Share on other sites More sharing options...
cooldude832 Posted December 10, 2007 Share Posted December 10, 2007 better idea is <?php $smiles = array("","") $replacements = array("<img src=\"smiley.jpg\" />","<img src=\"sad.jpg\" />"); $string = " Happy Sad"; $string = str_replace($smiles,$replacements,$string); echo $string; Link to comment https://forums.phpfreaks.com/topic/81033-solved-replace-text/#findComment-411156 Share on other sites More sharing options...
peranha Posted December 10, 2007 Author Share Posted December 10, 2007 Thanks, The array is what I was looking for. Link to comment https://forums.phpfreaks.com/topic/81033-solved-replace-text/#findComment-411206 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.