1">
当前位置:Gxlcms > PHP教程 > ereg()着色返回显示匹配结束

ereg()着色返回显示匹配结束

时间:2021-07-01 10:21:17 帮助过:8人阅读

  1. function replace($str)
  2. {
  3. static $color=0;
  4. $color+=50;
  5. return "<font style="\"color:rgb(255,".$color.",33)\"">".$str."</font>";
  6. }
  7. if( @ereg($match,$str,$array) )
  8. {
  9. if(count($array)>1)
  10. {
  11. $string=$str;
  12. $pos=strpos($string,$array[1]);
  13. $string=substr_replace($string,replace($array[1]),$pos,strlen($array[1]));
  14. $pos=$pos+strlen(replace($array[1]));
  15. echo $string.'<br>';
  16. for($i=2;$i<count($array);$i++) {="" $pos="strpos($string,$array[$i],$pos);" $string="substr_replace($string,replace($array[$i]),$pos,strlen($array[$i]));" echo="" $string.'<br="">';
  17. }
  18. } //end if(count($array)>1)
  19. print_r($array);
  20. }</count($array);$i++)>

人气教程排行