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? Quote Link to comment 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, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.