Sometimes for security reasons, we can’t display the full email on the page.
To Overcome this situation, We can replace Some Email characters with another sign.
Here is the code for adding another sign in the Email character.
We can use any sign for this; in this case, I used (*).
Add this code where you want to display Email.
<?php $original_email = "thecodehub_blog@gmail.com"; $explode_email = explode( "@", $original_email ); $explode_email_character = substr( $explode_email[0], 1 ); $explode_email_first_character = substr( $explode_email[0], 0, 1); // first world $email_character_length = strlen( $explode_email_character ); $add_star = ''; for( $i=0; $i<=$email_character_length; $i++ ){ $add_star .= '*'; } $final_email = $explode_email_first_character . $add_star . '@' . $explode_email[1]; ?> <h6>Original Email</h6> <p>thecodehub_blog@gmail.com</p> <h6>After apply (*) in Email</h6> <p><?php echo $final_email; ?></p>
Here is the Output: