$str = array("word1", "word2", "word3");
$str_bold = array("<b>word1</b>", "<b>word2</b>", "<b>word3</b>");
How can I add bolding tags arround (single) words in an array?
($str array can have 4, 5, 6 or more signle words in other occasions)
If you can tell me I can do this:
$sentence = "This sentence has word1 and word3 in it.";
$sentence_bold = str_replace($str,$str_bold,$sentence);
echo $sentence_bold;
output:
This sentence has word1 and word3 in it.