PHP Classes

X base: Convert numbers between different numeric bases

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 60%Total: 281 All time: 7,600 This week: 560Up
Version License PHP version Categories
x-base 1.0GNU General Publi...5PHP 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.

Picture of Uwe Stein
Name: Uwe Stein <contact>
Classes: 5 packages by
Country: Germany Germany
Age: 63
All time rank: 37423 in Germany Germany
Week rank: 416 Down16 in Germany Germany Up

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  
  • x_base_screenshot
  Files folder image Files  
File Role Description
Accessible without login Plain text file readme.txt Doc. small documentation
Accessible without login Plain text file test_x_base.php Example some examples
Plain text file x_base.php Class the objekt-class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:281
This week:0
All time:7,600
This week:560Up
 User Ratings  
 
 All time
Utility:75%StarStarStarStar
Consistency:75%StarStarStarStar
Documentation:75%StarStarStarStar
Examples:75%StarStarStarStar
Tests:-
Videos:-
Overall:60%StarStarStarStar
Rank:1214