Skip to content

Instantly share code, notes, and snippets.

@sarfraznawaz2005
Created October 19, 2016 08:46
Show Gist options
  • Save sarfraznawaz2005/de784ae454f4ca9089fd624b1043e02d to your computer and use it in GitHub Desktop.
Save sarfraznawaz2005/de784ae454f4ca9089fd624b1043e02d to your computer and use it in GitHub Desktop.
Safe Url encode decode 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