php method to hide the middle four digits of the mobile phone number: 1. Hide the middle four digits of the mobile phone number through the "substr_replace($num,'****',3,4);" method; 2. By automatically Just define the "yc_phone" function to hide the middle four digits.
The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer
php method hides the middle four digits of the mobile phone number
$num = "13966778888" $str = substr_replace($num,'****',3,4);
//自定义函数手机号隐藏中间四位 function yc_phone($str){ $str=$str; $resstr=substr_replace($str,'****',3,4); return $resstr; }
Usage in thinkphp template:
<span style="font-size:18px;"><volist name="zjd_list" id="vo"> <p>恭喜用户{$vo.user_id|yc_phone=###}砸金蛋获得奖金{$vo.prize}元</p> </volist></span>
[Recommended learning: PHP video tutorial]
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Chinese version
Chinese version, very easy to use

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
