<?php

$dot_prod = "at the coast will reach the Douglas County coast";
//=>         at the <b>coast</b> will reach <b>the</b> Douglas County coast

//Specifically, I want to bold the word "coast" and "the" but only the word coast if not preceded by the 
//word "county" and only the word "the" if not preceded by the word "at". So, essentially I want an array
//of words or phrases (case-insensitive that keeps the case the word/phrase was originally in) 
//to be bolded and then an array of words or phrases that I want to ensure are not bolded. 
//For instance, the array of words/phrases that I want bolded are:

$bold = array("coast", "the", "pass");
//and the array of words I want to ensure are unbolded are:

$unbold = array("county coast", "at the", "grants pass");
$rx = "~\b(?:" . implode("|", $unbold) . ")\b(*SKIP)(*F)|\b(?:" . implode("|", $bold) . ")\b~i";
echo "$rx\n";
echo preg_replace($rx, "<b>$0</b>", $dot_prod);