# X base: Convert numbers between different numeric bases

 Last Updated Ratings Unique User Downloads Download Rankings 2010-09-30 (6 years ago) Not enough user ratings Total: 267 All time: 7,261 This week: 1,109
 Version License PHP version Categories x-base 1.0 GNU General Publi... 5 PHP 5, Math
Description Author

This class can be used to convert numbers between different numeric bases.

It can take a number represented in a numeric base and convert it to the representation in a different base.

Currently it supports numeric bases between 2 and 72.

Name: Classes: Uwe Stein `` 5 packages by Uwe Stein Germany 56 361 24 in Germany 1577 81 in Germany

Details
 ```coded by uwe stein Copyright (C) 2010 Uwe Stein hints, suggestions and bug reports are welcome. Here is a small overview how to use the x_base object ---------------------------------------------------------------Class mebers:--------------------------------------------------- alnum_digit = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" default use upper case letters num the umber encoded with base base the used base ( bin, dec,..., oct, ... hex, ... ) max_base the maximum base = strlen( \$this->alnum_digit ); dec_num this always keeps the decimal Value of num ----------------------------------------------------------- public functions -------------------------------------------------- public function __construct(\$num,\$base=10) param : \$num = the number ( endoded with base ), [\$base] the used base public function getNum() param : none return : the the encoded value public function getDec() param : none return : the decimal value of num public function getBase() param : none return : the used base public function getMaxBase() param : none return : the highest valid value for base public function toUpper() param : none return : none purpose: changes the digit-set to upper Letters public function toLower() param : none return : none purpose: changes the digit-set to upper Letters public function mixedDigits() param : none return : none purpose: changes the digit-set to upper and lower Letters note : "01234567890123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" with mixed set the "A" and "a" represent different values public function getConvNum(\$base) param : the base to encode the number return : string with the encoded number purpose: retrieve a number encoded with bas note : the func doesnt change(restores) the values of class members public function setNum(\$value,\$base=10) param : \$num = the number ( endoded with base ), [\$base] the used base return : none purpose: change the values of an existing object public function setBase(\$base) param : the new base return : none purpose: change the used base ( and rebuild the encoded number ) ```
 Screenshots
 Files
File Role Description