Created
September 24, 2012 09:34
-
-
Save toshimaru/3775127 to your computer and use it in GitHub Desktop.
urlsafe base64 function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function base64_urlsafe_encode($val) { | |
$val = base64_encode($val); | |
return str_replace(array('+', '/', '='), array('_', '-', '.'), $val); | |
} | |
function base64_urlsafe_decode($val) { | |
$val = str_replace(array('_','-', '.'), array('+', '/', '='), $val); | |
return base64_decode($val); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment