The last example in this article starts with a string, displays it, encrypts it, displays the encrypted string, decrypts the encrypted string, and then displays the result. Sounds like a lot of work, but the code is really simple - see for yourself.
<!DOCTYPE html>
<html>
<body>
<?php
$string = "This is the unencrypted string";
echo $string;
echo "<br>";
$encrypted = base64_encode($string);
echo $encrypted;
echo "<br>";
$decrypted = base64_decode($encrypted);
echo $decrypted;
?>
</body>
</html>
And this is what happens when we run the code.