怎样用PHP把电话号码和姓名加星号?解决思路
怎样用PHP把电话号码和姓名加星号?
在网上找了一下,一个教材不行的
http://www.haogongju.net/art/848588
preg_replace('/(0[0-9]{2,3}[\-]?[2-9])[0-9]{3,4}([0-9]{3}[\-]?[0-9]?)/i','$1****$2',$phone);
我想把姓名和电话(固话8位或者手机11 中间部分变成*号
------解决方案--------------------
- PHP code
$tel1 = "13888111188";$tel2 = "+8613888111188";$tel3 = "0861088111188";$tel4 = "086-010-88111188";echo preg_replace('/(^.*)\d{4}(\d{4})$/','\\1****\\2',$tel1),"\n";echo preg_replace('/(^.*)\d{4}(\d{4})$/','\\1****\\2',$tel2),"\n";echo preg_replace('/(^.*)\d{4}(\d{4})$/','\\1****\\2',$tel3),"\n";echo preg_replace('/(^.*)\d{4}(\d{4})$/','\\1****\\2',$tel4),"\n";<br><font color="#e78608">------解决方案--------------------</font><br>
- PHP code
//屏蔽电话号码中间的四位数字function hidtel($phone){ $IsWhat = preg_match('/(0[0-9]{2,3}[\-]?[2-9][0-9]{6,7}[\-]?[0-9]?)/i',$phone); //固定电话 if($IsWhat == 1) { return preg_replace('/(0[0-9]{2,3}[\-]?[2-9])[0-9]{3,4}([0-9]{3}[\-]?[0-9]?)/i','$1****$2',$phone); } else { return preg_replace('/(1[358]{1}[0-9])[0-9]{4}([0-9]{4})/i','$1****$2',$phone); }}<div class="clear"> </div>

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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Differences: 1. Different meanings of communication. Cell phone refers to a digital cellular mobile phone, and mobile phone refers to a mobile phone. 2. Explain the difference in meaning. Cell phone means mobile phone, and mobile phone means mobile phone. 3. The user groups are different. Cell phone is American English and is widely used in Canada and the United States; mobile phone is British English and is widely used in Europe.

Successors of the Redmi Note 13 series phones are expected to land in about three months. While Xiaomi hasn't said anything about the new lineup, the first few details of the Redmi Note 14 Pro have leaked. This leak comes from Digital Chat Station, a

The Vivo Y300 Pro just got fully revealed, and it's one of the slimmest mid-range Android phones with a large battery. To be exact, the smartphone is only 7.69 mm thick but features a 6,500 mAh battery. This is the same capacity as the recently launc

HMDhasreleasedvariousdevicesoflate,includingseveralNokia-brandedfeaturephones.Forcontext,barelyamonthhasgonebysincethecompanypresentedtheNokia32102024,areincarnationoftheNokia3210tomarkits25thanniversary.Additionally

MySQL is a commonly used relational database management system that provides a variety of functions to process and operate data. Among them, the REPLACE function is used to replace the specified part of the string. In this article, we will introduce how to use the REPLACE function for string replacement in MySQL and demonstrate its usage through code examples. First, let’s take a look at the syntax of the REPLACE function: REPLACE(str,search_str,replace_str).

According to news from this site on September 3, Korean media TheElec reported yesterday that Samsung is testing Tokyo Electron (TEL)'s AcreviaGCB gas cluster beam (Note from this site: GasClusterBeam) system. TEL's AcreviaGCB system was released on July 8 this year. It can locally and accurately shape EUV lithography patterns through gas cluster beams, thereby repairing pattern defects and reducing pattern roughness. Industry insiders believe that TEL's Acrevia system can play a similar role to Applied Materials' CenturaSculpta system, that is, directly shape EUV exposure patterns, reduce costly EUV multiple exposures, thereby shortening the photolithography process and improving the overall

What are the string search and replace techniques in Python? (Specific code example) In Python, strings are a common data type, and we often encounter string search and replace operations in daily programming. This article will introduce some common string search and replacement techniques, accompanied by specific code examples. To find a specific substring in a string, you can use the find() method or index() method of the string. The find() method returns the index of the first occurrence of the substring in the string.

OnePlus is gearing up to launch the Ace 3 Pro in China. The launch is set for June 27, and the company has just confirmed a couple of core specs of the upcoming Android flagship. As previously speculated, the phone will feature the Snapdragon 8 Gen 3
