function GetRandomChar()
{
$a = "abcdefghijklmnopqrstuvwxyz";
return $a{rand() * 26};
}
preg_replace('/([0-9]+)a/ie', '$1.GetRandomChar()', $str);随便写的,自己去调试
{
$a = "abcdefghijklmnopqrstuvwxyz";
return $a{rand() * 26};
}
preg_replace('/([0-9]+)a/ie', '$1.GetRandomChar()', $str);随便写的,自己去调试
$re="\\1x"; // 试试。
$str="a,b,c8dkd,na";//n是可变化的,指任意数字
$patern="/(.*)[a-z]{1}$/i";
$re="\\1x"; //x是指任意字符
echo $str=preg_replace($patern,$re,$str);
?>