x****z@f*******.com
<?php
function hideEmail($email) {
list($user,$domain) = explode('@',$email);
$user = (strlen($user)>5) ? preg_replace('/(?!^.?).(?!.{0}$)/','*',$user) : preg_replace('/(?!^)./','*',$user);
$domain = preg_replace_callback('/([^@\.]+)(@|\.)/si',
function ($xt) {
return preg_replace('/(?!^)./','*',$xt[1]).$xt[2];}
,$domain);
return "$user@$domain";
}
echo '<pre>'.hideEmail($_GET['email']).'</pre>';
highlight_file(__FILE__);
?>