PHP uses base64 for encryption and decryption & nbsp; base64 for encryption and decryption in php: & nbsp; base64_encode () and base64_decode () for encryption and decryption. & nbsp; & n PHP implements encryption and decryption with base64
Php uses base64 for encryption and decryption: base64_encode () and base64_decode () for encryption and decryption.
Syntax: string base64_encode (string data)
Use base64 to encode data. This encoding is designed to enable binary data to be transmitted through a non-pure 8-bit transport layer, such as the subject of an email.
Base64-encoded data takes up about 33% more space than raw data.
Syntax: string base64_decode (string encoded_data)
Base64_decode () decodes encoded_data and returns the original data. if it fails, FALSE is returned. The returned data may be binary.
Example 1. base64_encode () example
$ Str = 'This is an encoded string ';
Echo base64_encode ($ str );
?>
This example will show:
VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw =
Example 2. base64_decode () example
$ Str = 'vghpcybpcybhbiblbmnvzgvkihn0cmluzw = ';
Echo base64_decode ($ str );
?>
This example will show:
This is an encoded string