Home>Article>Backend Development> How to hide the middle four digits of mobile phone number in php?

How to hide the middle four digits of mobile phone number in php?

coldplay.xixi
coldplay.xixi Original
2020-07-27 09:45:57 4487browse

php手机号码中间四位隐藏的方法:使用【substr_replace】代替方法,替换字符串的子串,代码为【$num = "12345678910" $str = substr_replace($num,'****',3,4)】。

How to hide the middle four digits of mobile phone number in php?

php手机号码中间四位隐藏的方法:

使用substr_replace代替方法:

$num = "12345678910" $str = substr_replace($num,'****',3,4);

How to hide the middle four digits of mobile phone number in php?

三种实现方式

 结果: > string(11) "123****8910" > string(11) "123****8910" > string(11) "123****8910"

相关学习推荐:PHP编程从入门到精通

The above is the detailed content of How to hide the middle four digits of mobile phone number in php?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to clear tags in php Next article:How to clear tags in php