php print email id with some part hidden -
i have variable contains email id
axceasddfe.gdfs@cif.in , csderid.asldfj@xiz.com
i want show them first 4 characters , ** continue replacing characters , @ , continue ** , com or in
example :
$email_id = "axceasddfe.gdfs@cif.in"; $email_text = convertemailformat($email_id);  echo $email_text; // ouput axce**********@****in i want convertemailformat function fo it.
try this:
  function obscure_email($email){        $email_array=explode('@', $email);        $email_word=$email_array[0];            $email_domain=$email_array[1];        $obscured_email=substr($email_word, 0, 3);        for($i=3; $i<strlen($email_word); $i++){          $obscured_email.='*';        }            $obscured_email.='@';            for($i=0; $i<strlen($email_domain)-2; $i++){                $obscured_email.='*';            }        return $obscured_email.substr($email, -2, strlen($email));    }    echo obscure_email('test@testing.com'); prints:
   tes*@*********om  
Comments
Post a Comment