$emailArr = explode("@",$email); if($emailArr[0]){ if($emailArr[0]>3){ $leng=3; }else{ $leng=1; } for ($i=0;$i<(strlen($emailArr[0])-$leng);$i++){ $stars.="*"; } $email=substr_replace($emailArr[0],$stars,$leng).$emailArr[1]; }
$emailArr = explode("@",$email); if($emailArr[0]){ if($emailArr[0]>3){ $leng=3; }else{ $leng=1; } for ($i=0;$i<(strlen($emailArr[0])-$leng);$i++){ $stars.="*"; } $email=substr_replace($emailArr[0],$stars,$leng).$emailArr[1]; }