Advertisement
Virajsinh

HIde Email in Php

Feb 24th, 2021
1,312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.31 KB | None | 0 0
  1. /*
  2.  
  3. Partially Hide Email in Php
  4.  
  5. This will turn great@gmail.com into g*****@g*****.com and
  6.  
  7. myemail@gmail.co.uk will become m*******@g*****.co.uk
  8.  
  9. and test.test@gmail.com into t*********@g*****.com
  10.  
  11. */
  12.  
  13. <?php
  14.  
  15. $email = preg_replace('/(?:^|@).\K|\.[^@]*$(*SKIP)(*F)|.(?=.*?\.)/', '*', $email);
  16.  
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement