SHARE
TWEET

Untitled

a guest Aug 25th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. declare(strict_types=1);
  3.  
  4. /**
  5.  * [base64url_encode base64 url encode data.]
  6.  *
  7.  * @param  string       $data Data to encode
  8.  *
  9.  * @return string|bool       Encoded Data. False, if data couldn't be encoded.
  10.  */
  11. function base64url_encode(string $data) {
  12.   $b64 = base64_encode($data);
  13.   if ($b64 === false) return false;
  14.   $url = strtr($b64, '+/', '-_');
  15.   return rtrim($url, '=');
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top