PHP-version of URL safe base64 encoding/decoding