<?php
$text = "brand c++ to c#";
$key = "c++";
$text = eregi_replace(ereg_replace("\+","\\+",$key),"<font color=\"#FF0000\"><b>".$key."</b></font>",$text);
echo $text;
?>
$text = "brand c++ to c#";
$key = "c++";
$text = eregi_replace(ereg_replace("\+","\\+",$key),"<font color=\"#FF0000\"><b>".$key."</b></font>",$text);
echo $text;
?>
$text = "brand c++ to c#";
$key = "c++";
$text = str_replace($key,"<font color=\"#FF0000\"><b>".$key."</b></font>",$text);
echo $text;
?>
这样子更直接些。