<?php 
$str="hello,中国人!"; 
$keyword="中";
$str=str_replace($keyword," <font color=red>".$keyword." </font>",$str); 
$keyword="人";
$str=str_replace($keyword," <font color=red>".$keyword." </font>",$str); 
echo $str; 
?> 
或者
<?php 
$str="hello,中国人!"; 
$keyword="中国人"; 
$str=str_replace($keyword," <font color=red>中</font>国<font color=red>人</font>".$str); 
echo $str; 
?> 
如果只是要搜索"中"和"人"中间有字的结果那就用正则表达式好了