3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $email = "h@hotmail.com"; $em = explode("@", $email); $name = $em[0]; echo ((strlen($name) > 3) ? substr($name, 0, 3) : "*") . "@$em[1]"; $email = "hag@hotmail.com"; $em = explode("@", $email); $name = $em[0]; echo ((strlen($name) > 3) ? substr($name, 0, 3) : "*") . "@$em[1]"; $email = "verylongemail@hotmail.com"; $em = explode("@", $email); $name = $em[0]; echo ((strlen($name) > 3) ? substr($name, 0, 3) : "") . "*@$em[1]";
Output for 4.3.0 - 7.1.0
*@hotmail.com*@hotmail.comver*@hotmail.com