I have a string that I converted to an array. And the same string that I converted are keywords from a search that match keywords in a chunk of text.
I am wanting to with the array, use the keywords within it to add html tags to the chunk of text that have the similar keywords.
For example: keywords: dog, cat, cow
Text before: I own two dogs, four cats, and twenty cows.
Text after: I own two dogs, four cats, and twenty cows.
The chunk of text I have is in a variable.
But I am not sure what regex I exactly need, to use with preg_replace();.
<?php
echo preg_replace($text, <b></b>, $keywords);
?>
Am I even going the right direction?