PHP 8.5.0 Alpha 2 available for testing

Voting

: eight minus six?
(Example: nine)

The Note You're Voting On

Tom
18 years ago
This function supports "base64url" as described in Section 5 of RFC 4648, "Base 64 Encoding with URL and Filename Safe Alphabet"

<?php
function base64url_encode($plainText)
{
$base64 = base64_encode($plainText);
$base64url = strtr($base64, '+/', '-_');
return (
$base64url);
}
?>

You may wish to rtrim (or escape) trailing ='s for use in a URI.

<< Back to user notes page

To Top