Hey 🙂 i have the following code:
if ($_GET['search']!="") {
$getwords = explode(" ", $_GET['search']);
$countgetwords = count($getwords);
for ($i=0; $i<$countgetwords; $i++) {
$message = preg_replace("/$getwords[$i]/i", " <span class='highlight'>$getwords[$i]</span> ", $message);
}
}
Basically its highlighting words that have been searched for. The trouble is if i search for 'and' and there is a 'handy' written in the text... it will highlight the 'and' within the 'handy' if that makes sense, lol... I only want it to highlight the word 'and'. Can someone please suggest how i can make this possible??
Many Thanks, BIOSTALL