base64_encode in PHP

Syntax of base64_encode

string base64_encode(string data)

Returns a base-64-encoded version of data. MIME base-64 encoding is designed to allow binary or other 8-bit data to survive transition through protocols that may not be 8-bit safe, such as email messages

Example of base64_encode

<?php
$str = 'This is an encoded string';
echo base64_encode($str);
?>
VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==

Leave a Comment