Advertisement
Virajsinh

HIde Email in Php

Feb 24th, 2021
1,341
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 [email protected] into g*****@g*****.com and
  6.  
  7. [email protected] will become m*******@g*****.co.uk
  8.  
  9. and [email protected] 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