You're probably looking for this:
$txt = preg_replace("#\b($a|$h)\b#i",
"<span style='background-color:#EEEE00'>$1</span>", $txt);
... or, if you want to highlight the whole array of words (being able to use metacharacters as well):
$txt = 'Hi! How are you doing? Have some stars: * * *!';
$array_of_words = array('Hi!', 'stars', '*');
$pattern = '#(?<=^|W)('
. implode('|', array_map('preg_quote', $array_of_words))
. ')(?=$|W)#i';
echo preg_replace($pattern,
"<span style='background-color:#EEEE00'>$1</span>", $txt);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…