seco Posted April 6, 2008 Share Posted April 6, 2008 Hi i want to wrap every specified word like <B>$the word</B> before printing it to the page how? Link to comment https://forums.phpfreaks.com/topic/99799-how-to-wrap-a-word-with-some-text-specified/ Share on other sites More sharing options...
uniflare Posted April 6, 2008 Share Posted April 6, 2008 $string = str_replace("word","<b>word</b>",$string); or for different words: $words = array( "word 1", "word 2", "word 3" ); $replacements = array( "<b>word 1</b>", "<b>word 2</b>", "<b>word 3</b>" ); $string = str_replace($words,$replacements,$string); hope this helps, Link to comment https://forums.phpfreaks.com/topic/99799-how-to-wrap-a-word-with-some-text-specified/#findComment-510420 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.