*4位隐藏

$mobile = 13427987654;
if (preg_match("/^1[3|4|5|8][0-9]d{4,8}$/",$mobile) {
   $mobile = substr_replace($mobile,'****',3,4);
} 
原文地址:https://www.cnblogs.com/bubaya/p/7565056.html