3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function maskString($string) { return preg_replace('/(?<=.)','*',$string); } function maskEmail($email) { $arremail = explode('@',$email); //$email1 = preg_replace('/(?<=.).(?=.*@)/u','*',$arremail[0].'@'); //$email2 = preg_replace('/(?<=.).(?=.*[.])/u','*',$arremail[1]); //return $email1.$email2; return maskString($arremail[0]); } $email = 'facebook@yahoo.co.id'; $result = maskEmail($email); echo $result;
based on m0Fne
Output for 4.3.11 - 7.3.0beta1
Warning: preg_replace(): No ending delimiter '/' found in /in/9Vebt on line 4
Output for 4.3.0 - 4.3.10
Warning: No ending delimiter '/' found in /in/9Vebt on line 4