PHP hides the middle 4 digits of mobile phone number

Time:2021-3-25

Today, I suddenly think of the mobile phone number. It’s better to hide this kind of private information in the project. So let’s summarize the methods that can be used, which are limited to the 11 digit mobile phone numbers in the mainland

Method demonstration

  1. usesubstr_replacefunction

    # substr_ Replace - substring of the replacement string
  2. Using regular expressions

    # preg_ Replace - performs the search and replacement of a regular expression
  3. usesubstrfunction

    #Function description

summary

There are many ways, most of which are more appropriate


php

This work adoptsCC agreementReprint must indicate the author and the link of this article

Don’t ask me which song was in the ’80s

Recommended Today

VBS obtains the operating system and its version number

VBS obtains the operating system and its version number ? 1 2 3 4 5 6 7 8 9 10 11 12 ‘************************************** ‘*by r05e ‘* operating system and its version number ‘************************************** strComputer = “.” Set objWMIService = GetObject(“winmgmts:” _  & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”) Set colOperatingSystems = objWMIService.ExecQuery _  (“Select * from […]