PHP Classes

File: readme.txt

Recommend this page to a friend!
  Classes of Uwe Stein   X base   readme.txt   Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: small documentation
Class: X base
Convert numbers between different numeric bases
Author: By
Last change:
Date: 13 years ago
Size: 2,476 bytes
 

Contents

Class file image Download
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 )