(Or looking for highlighting PHP code itself?)
htmlspecialchars()
$output = preg_replace( "/(>|^)([^<]+)(?=<|$)/esx", "'\\1' . str_replace('" . $keyword . "', '<b>" . $keyword . "</b>', '\\2')", $input );