php正则实现替换电话的方法:1、创建一个PHP示例文件;2、通过“preg_replace($pattern, $replacement,$str);”替换电话中间四位数字即可。
本文操作环境:Windows7系统,PHP7.1版,Dell G3电脑。
php正则怎么实现替换电话?
php手机号正则替换中间四位
php手机号正则替换中间四位代码如下:
$str = '13525462555'; $pattern = '/(\d{3})(\d{4})(\d{4})/i'; $replacement = '$1****$3'; $resstr = preg_replace($pattern, $replacement,$str); echo $resstr
效果如下:
183****3322
推荐学习:《PHP视频教程》
The above is the detailed content of How to implement replacement phone calls in php regular code. 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

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Chinese version
Chinese version, very easy to use

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
