Encode and decode string with Base64 using PHP

base64_encode — Encodes data with MIME base64
string base64_encode ( $string )
This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
Base64-encoded data takes about 33% more space than the original data.

$plainText = 'http://www.phpjavascript.com/';
$base64 = base64_encode($plainText);
$base64url = strtr($base64, '+/=', '-_,');
echo $base64url;

$plainText = "aHR0cDovL3d3dy5waHBqYXZhc2NyaXB0LmNvbS8,";
$base64url = strtr($plainText, '-_,', '+/=');
$base64 = base64_decode($base64url);
echo $base64;

1 comment:

  1. If you want a babe from the house ofcall girls in jaipurthere are a few things you should know well before making a booking. Firstly our agency here at your city. In simple words is a cut above the rest because of the highly professional services we provide to our clients. Check our other Services...
    russian call girls in jaipur
    housewife call girls in jaipur
    housewife escorts in jaipur
    female escorts in jaipur
    female escorts in agra
    call girls in agra
    escorts service in agra
    hi profile escorts in agra
    russian escorts in agra



php (35) javascript (31) phpjavascript (30) jquery (23) html (20) mysql (14) database (9) codeigniter (4) json (4) bar chart (2) calendar (2) column chart (2) framework (2) google maps (2) query (2) tables (2) url (2) dropdown (1)

Popular Posts