How can PHP functions be utilized to encrypt email addresses that are stored as variables and displayed in the source code?

Email addresses stored as variables in the source code can be encrypted using PHP functions like base64_encode() and base64_decode(). By encrypting the email addresses, you can prevent them from being easily harvested by bots scanning the source code. To display the encrypted email addresses on the website, you can decode them before outputting them to the user.

<?php
$email = 'example@example.com';
$encrypted_email = base64_encode($email);
echo 'Encrypted Email: ' . $encrypted_email . '<br>';

// To display the decrypted email address
$decrypted_email = base64_decode($encrypted_email);
echo 'Decrypted Email: ' . $decrypted_email;
?>