Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

How to Partially hiding an email address using PHP regex

by
Category:php
php
How to Partially hiding an email address using PHP regex

In this tutorial i will show you how to email address partially using php regex. Many php project need this type speciality. I want to display email from database and I want to only show some character not a all. You may also like How to check validation url www and href in PHP and How to Hide numbers of a Phone Number using PHP.

PHP Code

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

Output

h************@g*****.com

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


0 Comments


Html code work in comment box


Related Post