Skip to content

Instantly share code, notes, and snippets.

@CodeNegar
Forked from justinkelly/base64_url.php
Created September 19, 2012 05:20
Show Gist options
  • Save CodeNegar/3747825 to your computer and use it in GitHub Desktop.
Save CodeNegar/3747825 to your computer and use it in GitHub Desktop.
simple base64 encode/decode url safe functions
<?php
function base64_url_encode($input)
{
return strtr(base64_encode($input), '+/=', '-_,');
}
function base64_url_decode($input)
{
return base64_decode(strtr($input, '-_,', '+/='));
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment