note 127544 added to function.base64-encode

From: Date: Sat, 27 Aug 2022 10:11:57 +0000
Subject: note 127544 added to function.base64-encode
Groups: php.notes 
Request: Send a blank email to php-notes+get-219483@lists.php.net to get a copy of this message
Improvement on "gutzmer at usa dot net", "biziclop at vipmail dot hu", and "ivanm at duck dot com". <?php function base64url_encode($data) { return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); } function base64url_decode($data) { return base64_decode(strtr($data, '-_', '+/')); } ?> None of the padding for strings longer than 4 characters worked. Padding the decode function with = is unnecessary, and has been since at least PHP 5.4 (as far back as I checked before posting) so I removed it. ---- Server IP: 45.112.84.4 Probable Submitter: 185.85.3.173 (proxied: 49.198.14.43) ---- Manual Page -- https://php.net/manual/en/function.base64-encode.php Edit -- https://main.php.net/note/edit/127544 Del: integrated -- https://main.php.net/note/delete/127544/integrated Del: useless -- https://main.php.net/note/delete/127544/useless Del: bad code -- https://main.php.net/note/delete/127544/bad+code Del: spam -- https://main.php.net/note/delete/127544/spam Del: non-english -- https://main.php.net/note/delete/127544/non-english Del: in docs -- https://main.php.net/note/delete/127544/in+docs Del: other reasons-- https://main.php.net/note/delete/127544 Reject -- https://main.php.net/note/reject/127544 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#219483) next »