$string = 'php highlight search results';
$words = array_unique(explode(' ', $string));
// now use a loop
the array_unique is so you dont double highlight something if the user entered the same term more than once.
you may also want to build someting in to handle if the user entered more than 1 space between certain words.