In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains how to replace the ID card number with an asterisk in php. Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "php how to replace the ID number with an asterisk"!
In php, you can use the substr_replace () function to replace the ID number with an asterisk, with the syntax "substr_replace (ID string, asterisk string, position to start replacement, length of replacement string);", where the length of the replacement string is the same as the length of the asterisk string.
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
The method of replacing ID card number with asterisk by php
In PHP, we can use the substr_replace () function to replace the asterisk with the ID number, and the substr_replace () function to replace part of the string with another string.
The syntax of the substr_replace () function is:
Substr_replace (string,replacement,start,length)
Among them, it should be noted that:
The string parameter is required to indicate the string to be checked, and the replacement parameter is also required to indicate the string to be inserted.
The start parameter is required to specify where to start the replacement of the string.
Positive number-starts replacement at the specified position in the string
Negative number-replaces at the specified position at the end of the string
0-start substitution at the first character in the string
The length parameter is optional, indicating how many characters are specified to be replaced. The default is the same length as the string.
Positive number-the length of the string being replaced
Negative number-indicates the number of characters at the end of the substring to be replaced from the end of the string.
0-insert instead of replace
Examples are as follows:
Output result:
At this point, I believe you have a deeper understanding of "how to replace the ID card number with an asterisk in php". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 239
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.