将邮箱的某一段替换为*
将邮箱地址的第3 位到'@'之间的字符串替换为符号'*' 谢谢
------解决方案--------------------
echo preg_replace('/(?<=.{3}).+@/', '*@', [email protected]');[email protected]
$str ="[email protected]";<br />$sub = substr($str, 2,strpos($str,'@') -2);<br />$len = strlen($sub);<br />$replaceStr = str_repeat('*',$len);<br />$newStr = str_replace($sub, $replaceStr, $str);<br />var_dump($newStr);