RFC4648 specifies an alternate alphabet for base64 encoding / decoding where '+' and '/' are exchanged for '-' and '-' to make the resulting string safe to use in filenames and URLs. This adds a base64url_encode() function that uses the alternate alphabet. The base64_decode() function is extended to accept both alphabets.