How to Partially hiding an email address using PHP regex

0
php

In this tutorial, I will show you how to email address partially using PHP regex. Many PHP project needs this type of specialty. I want to display email from a database and I want to only show some character not an all. You may also like How to Call jquery ajax in Codeigniter php

PHP Code

<?php
$email = 'youremailaddrss@website.com';
echo $email = preg_replace('/(?:^|@).\K|\.[^@]*$(*SKIP)(*F)|.(?=.*?\.)/', '*', $email);
?>

Output

y************@w*****.com

And if you like these tutorials please share it with your friends via Email or Social Media.