Math_Basex
[ class tree: Math_Basex ] [ index: Math_Basex ] [ all elements ]

Class: Math_Basex

Source Location: /Math_Basex-0.3.1/Basex.php

Class Overview


base X coding class


Author(s):

Version:

  • 0.3.1

Methods


Inherited Variables

Inherited Methods


Class Details

[line 53]
base X coding class

I noticed that value of an int is different on most systems. On my system (linux 2.4.18 with glibc 2.2.5) i can use 8-byte integers (also called int64 or int8) On my laptop (Windows 2000) i only could use numbers up to 4-byte (32 bit) integers. So you might want to test this first!

Note that you can without much effort also use the bcmath extentions to increase the length of your numbers.



[ Top ]


Method Detail

Math_Basex (Constructor)   [line 75]

void Math_Basex( [string $tokens = ""])

Constructor for class

Parameters:

string   $tokens   —  Character base set (Each character is only allowed once!)

[ Top ]

baseConvert   [line 376]

string baseConvert( mixed $number, int $from_base, int $to_base, [string $from_cs = null], [string $to_cs = null])

Converts a number from one base into another. May be called statically.
  • Access: public

Parameters:

mixed   $number   —  The number to convert
int   $from_base   —  The base to convert from
int   $to_base   —  The base to convert to
string   $from_cs   —  Optional character set of the number that is converted
string   $to_cs   —  Optional character set of the target number

[ Top ]

getBase   [line 173]

integer getBase( )

Returns the base scale. Note that this is onyl the count of the characters used for the encoding and decoding.

Please do not use base_convert with this class, because it might result in rare results

  • Access: public

[ Top ]

instance   [line 420]

object &instance( )

Singleton method, call statically
  • Access: public

[ Top ]

setBase   [line 96]

void setBase( string $tokens)

Change the character base set. Behaves the same way the constructor does.
  • Access: public

Parameters:

string   $tokens   —  Character base set (Each character is only allowed once!)

[ Top ]

stdBase   [line 356]

string stdBase( [int $n = 62])

Returns a common set of digits (0-9A-Za-z), length is given as parameter
  • Access: public

Parameters:

int   $n   —  Optional How many characters to return, defaults to 62.

[ Top ]

toBase   [line 114]

string toBase( mixed $number)

toBase translates a decimal (base 10) number into your base 'code'
  • Return: encoded 'code' of yout decimal number

Parameters:

mixed   $number   —  (int64 or double without floats, both are 8-byte number types). This allows you to use numbers up to 18446744073709551616.

[ Top ]

todecimal   [line 145]

int64 todecimal( string $code)

toDecimal decodes the baseX 'code' back to a decimal number
  • Return: decimal (base 10) number

Parameters:

string   $code   —  code to decode

[ Top ]


Documentation generated on Wed, 09 Dec 2015 22:45:34 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.