Base64 Encode and Decode String in PHP

Encodes the given data with MIME base64. Base64-encoded data takes about 33% more space than the original data.

[View All Snippets]
Show Plain Text »
  1. <?php
  2. function base64url_encode($text){
  3.     $base64 = base64_encode($text);
  4.     $base64url = strtr($base64, '+/=', '-_,');
  5.     return $base64url;
  6. }
  8. function base64url_decode($text){
  9.     $base64url = strtr($text, '-_,', '+/=');
  10.     $base64 = base64_decode($base64url);
  11.     return $base64;
  12. }
  13. ?>
Create Your Free Account
Please remember that this information is essential to use our services correctly.
After creating the account you will be able to download all of our FREE products.
Fields marked with * are mandatory

Please send me information about updates, new products, specials and discounts from ApPHP!
We recommend that your password should be at least 6 characters long and should be different from your username/email. Please use only letters of the English alphabet to enter your name.

Your e-mail address must be valid. We use e-mail for communication purposes (order notifications, etc). Therefore, it is essential to provide a valid e-mail address to be able to use our services correctly.

All your private data is confidential. We will never sell, exchange or market it in any way. Please refer to Privacy Policy.

By clicking "Create Account", you are indicating that you have read and agree to the ApPHP Terms & Conditions.

Quick Registration with: Facebook / Google