Table of Contents

base64_encode

WMPRO, WMMINI FW >= 1.893 WMMEGA FW >= 2.0

Return the base64-encoded version of a string

Description

mixed base64_encode ( string $data )

Encodes data using MIME Base641)

Parameter

$data: A string to encode

Return Values

MIME Base64 encoded string (or int 0 for error)

Example

<?
  $data="This will be an encoded string";
  print(base64_encode($data));
?>

The above example will output:

VGhpcyB3aWxsIGJlIGFuIGVuY29kZWQgc3RyaW5n 

See Also

base64_decode() - Decode a base64-encoded string

1)
The term Base64 is generic, and there are many implementations. MIME, which stands for Multi-purpose Internet Mail Extensions, is the most common that is seen today. It is used wherever there is a need to transmit strings that might contain special characters that would otherwise be interpreted, blocked or converted during transmission, for example, sending a password string to a server. Encoding data in Base64 results in it taking up roughly 33% more space than the original data. MIME Base64 encoding uses an '=' character at the end of a string to signify whether the last character is a single or double byte.