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

How to Partially hide email address using PHP

How to Partially hide email address using PHP

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

PHP Code

    function partially_email($email)
        $em   = explode("@",$email);
        $name = implode(array_slice($em, 0, count($em)-1), '@');
        $len  = floor(strlen($name)/2);
        return substr($name,0, $len) . str_repeat('*', $len) . "@" . end($em);   

    $email = '';
    echo partially_email($email);



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


Html code work in comment box

Related Post