Encodes data into a Base64 string.
Base64 turns any data - even bytes that aren’t normal text - into plain text characters. That lets it go through JSON, a remote, or a file without breaking. The result is about a third bigger than the input.
Most commonly used to make a binary payload safe to send over request or store with writefile.
Parameters
Returns
string - the Base64-encoded text.
Aliases
base64.encode
base64_encode
base64encode
crypt.base64.encode
crypt.base64_encode
Example
Encode a value with Base64, then cache it to disk with writefile.
Useful for encoding binary payloads before saving or transmission.