I ran into a problem the other day where I needed to increment an alphanumeric string. An alphanumeric string is a string consisting of both numerals and letters (0-9, a-z, A-Z). This combination of characters is base62, however, there is no base62 function in PHP to make this easy. There were a couple of solutions out there, but I didn’t really like any of them. So I decided to sit down and write out one that suited my needs. Here it is:

I also created a GitHubGist for this snippet.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.