php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jimktrains at gmail dot com
New email:
PHP Version: OS:

 

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

This change would be backwards compatible.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-12 04:47 UTC] aharvey@php.net
-Status: Open +Status: Wont fix -Package: *General Issues +Package: Math related
 [2011-01-12 04:47 UTC] aharvey@php.net
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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 12:01:29 2025 UTC