字符串截取法
/**
* 中间加密 字符串截取法
*/
public static function encryptTel($tel) {
$new_tel = substr($tel, 0, 3).'****'.substr($tel, 7);
return $new_tel;
}
替换字符串
/**
* 中间加密 替换字符串的子串
*/
public static function encryptTel($tel) {
$new_tel = substr_replace($tel, '****', 3, 4);
return $new_tel;
}
正则
/**
* 中间加密 用正则
*/
public static function encryptTel($tel) {
$new_tel = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $tel);
return $new_tel;
}
未经允许不得转载:任鹏个人博客 » PHP实现手机号码中间四位数替换成”*”
最新评论
Forex wiki. https://lt.forex-stock-bitcoin-brokers.com
Magnificent items from you, man. I have take note your stuff
Following on from the 3rd March Meetings held by economic de
It is remarkable, rather valuable message dfgdlfg2131.32
一般都会有一个沙盒期的,过了沙盒期就会慢慢放出来
百度不收录是应为是新站的原因吗?
The spike in consumer prices that left inflation at a four-d