How does PHP use asterisks to hide user names, cell phone numbers and mailboxes
This article mainly explains "how PHP uses asterisks to hide user names, mobile phone numbers and mailboxes". 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 hide user names, mobile phone numbers and mailboxes with asterisks."
A simple and practical PHP uses asterisks to hide user names, mobile phone numbers and mailboxes, and replaces some of the users' text messages with asterisks in order to protect users' privacy.
Hide function:
Function hideStar ($str) {/ / username, mailbox, mobile account middle string to * hide if (strpos ($str,'@') {$email_array = explode ("@", $str); $prevfix = (strlen ($email_array [0]) < 4)? "": substr ($str, 0,3); / / mailbox prefix $count = 0 $str = preg_replace ('/ ([\ d\ winters -] {0100}) @ /','* @', $str,-1, $count); $rs = $prevfix. $str;} else {$pattern ='/ (1 [3458] {1} [0-9]) [0-9] {4} ([0-9] {4}) / iTunes; if (preg_match ($pattern, $str)) {$rs = preg_replace ($pattern,'$1 million, $str); / / substr_replace ($name,'****',3,4) } else {$rs = substr ($str, 0,3). "*". Substr ($str,-1);}} return $rs;}
Test data:
Display the instance with an asterisk *:
Account mailbox mobile phone here, I believe you have a deeper understanding of "how PHP uses asterisks to hide user names, mobile numbers and mailboxes". 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!