How can I hide the email address in the following text? $ Str & #039; Chinese character is scddtest001@qq.comasdatest002 @ qq.com after you amtest009@aa.com last mailbox defse@ff.com & #039; the expected result is: {code ...} how can I hide the email address in the following text?
$ Str = 'character is scdd test001@qq.com asda test002@qq.com after you am test009@aa.com last mailbox defse@ff.com ';
Expected results:
The Chinese character is scdd ******** @ qq.com asda ******** @ qq.com your post am ******** @ aa.com's last mailbox ** * ** @ ff.com
Reply content:
How can I hide the email address in the following text?
$ Str = 'character is scdd test001@qq.com asda test002@qq.com after you am test009@aa.com last mailbox defse@ff.com ';
Expected results:
The Chinese character is scdd ******** @ qq.com asda ******** @ qq.com your post am ******** @ aa.com's last mailbox ** * ** @ ff.com
$ Str = 'character is scdd test001@qq.com asda test002@qq.com your post am test009@aa.com last mailbox defse@ff.com '; $ replace = "*"; echo preg_replace_callback ('/([a-zA-Z0-9] *) @ ([a-zA-Z0-9] * \. com)/', function ($ matches) use ($ replace) {return str_repeat ($ replace, strlen ($ matches [1]). "@". $ matches [2] ;}, $ str );