Voting

: max(two, three)?
(Example: nine)

The Note You're Voting On

ivanm at duck dot com
3 years ago
Slight improvement on the padding problem in gutzmer at usa dot net (https://www.php.net/manual/en/function.base64-encode.php#103849) and biziclop at vipmail dot hu (https://www.php.net/manual/en/function.base64-encode.php#121767):

<?php
function base64url_encode($data) {
return
rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}

function
base64url_decode($data) {
return
base64_decode(str_pad(strtr($data, '-_', '+/'), 4 - ((strlen($data) % 4) ?: 4), '=', STR_PAD_RIGHT));
}
?>

<< Back to user notes page

To Top