Is there some way to detect if a string has been base64_encoded() in PHP?
We\'re converting some storage from plain text to base64 and part of it lives in a cookie
Here's my solution:
if(empty(htmlspecialchars(base64_decode($string, true)))) { return false; }
It will return false if the decoded $string is invalid, for example: "node", "123", " ", etc.
$string