ereg() 着色返回显示匹配结束
span style=color:#e53333;font-weight:bold;错误难免,多多span style=color:#e53333;指出/span!!!/span br / 演试地址: a target=_blank href=http://www.dworry.tk/phptest/post.php rel=nofollowhttp://www.dworry.tk/phptest/post.p
错误难免,多多指出!!!
演试地址: http://www.dworry.tk/phptest/post.php
演试地址: http://www.dworry.tk/phptest/post.php
function replace($str)
{
static $color=0;
$color+=50;
return "<font style=\"color:rgb(255,".$color.",33)\">".$str."</font>";
}
if( @ereg($match,$str,$array) )
{
if(count($array)>1)
{
$string=$str;
$pos=strpos($string,$array[1]);
$string=substr_replace($string,replace($array[1]),$pos,strlen($array[1]));
$pos=$pos+strlen(replace($array[1]));
echo $string.'<br/>';
for($i=2;$i<count($array);$i++)
{
$pos=strpos($string,$array[$i],$pos);
$string=substr_replace($string,replace($array[$i]),$pos,strlen($array[$i]));
$pos=$pos+strlen(replace($array[$i]));
echo $string.'<br/>';
}
} //end if(count($array)>1)
print_r($array);
}
精彩图集
精彩文章






