It's free and you have access to premium codes!
Welcome back! Please login to your account.
Don't worry, we'll send you a message to help you to recover your acount.
Please check your email for instructions to activate your account.
Written by 4 November 2022
This handy function hides an email in the following format for preview purposes k*****@g********
<!-- this script is provided by https://www.phpfreecode.com coded by: Kerixa Inc. -->
<?php
function formatEmailForPreview($email){
$domain = str_split(strstr($email, "@"));
array_shift($domain);
$user = str_split(strstr($email, "@", true));
$user_format = "";
for($i = 0; $i < count($user); $i++){
if($i == 0 || $i == (count($user) - 1)){
$user_format .= $user[$i];
}else{
$user_format .= "*";
}
}
$domain_format = "";
for($i = 0; $i < count($domain); $i++){
if($i == 0 || $i == (count($domain) - 1)){
$domain_format .= $domain[$i];
}else{
$domain_format .= "*";
}
}
return $user_format . "@" . $domain_format;
}
?><a target='_blank' href='https://www.phpfreecode.com' style='font-size: 8pt; text-decoration: none'>Php Best Codes</a>
Comments
Here you can leave us commments. Let us know what you think about this code tutorial!