|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53708 base_convert could go to base 62 or 64
Submitted: 2011-01-10 17:07 UTC Modified: 2011-01-12 04:47 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jimktrains at gmail dot com Assigned:
Status: Wont fix Package: Math related
PHP Version: trunk-SVN-2011-01-10 (SVN) OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jimktrains at gmail dot com
New email:
PHP Version: OS:


 [2011-01-10 17:07 UTC] jimktrains at gmail dot com
base_convert ( should/could go to base 62 (0-9a-zA-Z) or base64 (standard encoding).

This change would be backwards compatible.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-12 04:47 UTC]
-Status: Open +Status: Wont fix -Package: *General Issues +Package: Math related
 [2011-01-12 04:47 UTC]
The mapping of values to characters occurs in a different order in
"standard" Base64 to the way base_convert() currently works, so
extending base_convert() out to 64 wouldn't make much sense, since it
would either be inconsistent with the existing behaviour of
base_convert() or base64_encode(), and either way I can only see it
confusing people.

Going to 62 would be possible, but as a cursory Web search for Base62
shows, there's no real standard -- even an informal one -- for how the
character set is ordered: the most common order seems to be 0-9a-zA-Z,
but there are plenty of examples of 0-9A-Za-z as well, not to mention
implementations that are simple variants of Base64 (which is, of
course, A-Za-z0-9, then two non-alphanumeric characters that nobody
seems to be able to agree on).

While it would be nice to have a Base62 conversion function (since it
is quite useful in URLs), I don't think the PHP standard library is
the place for it at the moment; developers will be better off using an
implementation that implements the actual variant they want.

Closing won't fix.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Apr 16 00:01:23 2021 UTC