PHP Classes

AnyBase: Encode and decode numbers in any base up to 65

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 164 All time: 8,921 This week: 47Up
Version License PHP version Categories
anybase 1.0Freeware5PHP 5, Text processing, Math
Description 

Author

This class can encode and decode numbers in any base up to 65, where PHP base_convert only works up to 36.

It can take a given number and convert it into a text string made of characters that represent that number in any number base.

The class can also take a previously encoded number as text string and retrieve the original number value.

Picture of Michael Richey
  Performance   Level  
Name: Michael Richey <contact>
Classes: 1 package by
Country: United States United States
Age: 50
All time rank: 4250539 in United States United States
Week rank: 180 Up22 in United States United States Up

Documentation

Create a base numbering system to meet your needs.

Designed to create short urls based on a decimal id number - the default charset contains the unreserved URL characters and is good up to base65.

Using AnyBase is simple. Simply, initialize an object with or without a charset and use it to encode or decode a number.

$b65 = new AnyBase();

$original = 1000000;

$encoded = $b65->encode($original); // '3FIE'

$decoded = $b65->decode($encoded); // 1000000


  Files folder image Files (2)  
File Role Description
Plain text file AnyBase.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:164
This week:0
All time:8,921
This week:47Up