In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces how php hides the middle characters. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
Php hide the middle characters: 1, through the "function func_substr_replace () {...}" method to hide the middle part of the number; 2, through the "function substr_cut ($user_name) {...}" method to hide the middle and replace with an asterisk.
This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer
How does php hide intermediate characters?
PHP implements partial character hiding
/ * * hide partial string * # this method is mostly used to hide the middle digits of mobile phone number or ID number and bank card number * / function func_substr_replace ($str, $replacement ='*', $start = 1, $length = 3) {$len = mb_strlen ($str,'utf-8'); if ($len > intval ($start+$length)) {$str1 = mb_substr ($str,0,$start,'utf-8') $str2 = mb_substr ($str,intval ($start+$length), NULL,'utf-8');} else {$str1 = mb_substr ($str,0,1,'utf-8'); $str2 = mb_substr ($str,$len-1,1,'utf-8'); $length = $len- 2;} $new_str = $str1; for ($I = 0; $I < $length; $iTunes +) {$new_str. = $replacement } $new_str. = $str2; return $new_str;} / * retains only the beginning and end characters of the string, and hides the formatted name * / function substr_cut ($user_name) {$strlen = mb_strlen ($user_name, 'utf-8') of * @ param string $user_name name * @ return string instead of * in the middle of the two characters. $firstStr = ucfirst (strtolower (mb_substr ($user_name, 0,3, 'utf-8')); $lastStr = strtolower (substr ($user_name,-3)); if ($strlen = = 2) {$hideStr = str_repeat (' *, strlen ($user_name, 'utf-8')-1); $result = $firstStr. $hideStr;} else {$hideStr = substr (str_repeat ("*", $strlen-6), 0,3); $result = $firstStr. $hideStr. $lastStr;} return $result;} about how to hide intermediate characters in php is shared here. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.
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: 0
*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.