将手机号中间四位转为*号
将手机号中间四位转为*号本文关键字词:php正则,手机号码隐藏, preg_replace
function changeNum($string){
$pattern = “/(1\d{2})\d{4}(\d{4})/”;
$replacement = “\$1****\$2″;
return preg_replace($pattern,$replacement,$string);
}
preg_replace:执行一个正则表达式的搜索和替换(PHP 4, PHP 5)
页:
[1]