Jump to content

how to wrap a word with some text specified


seco

Recommended Posts

$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,

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.