Class Number

Description

Utility methods to manipulate numeric values

Located in /core/util/Number.class.php (line 38)

PHP2Go
   |
   --Number
Method Summary
static string formatByteAmount (int $amount, [string $mode = ''], [int $precision = 2])
static string fromArabicToRoman (float $arabic)
static string fromDecimalToCurrency (float $number, [string $currencySign = NULL], [string $decSep = NULL], [string $thousSep = NULL], [int $precision = NULL], [string $currencySignPos = NULL])
static mixed fromDecimalToFraction (float $number)
static string fromHexToBin (string $number)
static float fromRomanToArabic (string $roman)
static int gcd (int $a, int $b)
static int modulus10 (int $number)
static int modulus11 (int $number, [int $base = 9])
static mixed numberConversion (mixed $source, int $baseIn, int $baseOut, [int $targetLen = 0])
static int randomize (int $rangeMin, int $rangeMax)
Methods
static method formatByteAmount (line 282)

Builds an human-readable representation of a byte amount

Examples:

  1.  Number::formatByteAmount(65536'K');
  2.  Number::formatByteAmount(16*1024*1024'M');

static string formatByteAmount (int $amount, [string $mode = ''], [int $precision = 2])
  • int $amount: Byte amount
  • string $mode: Mode: K, M, G or T
  • int $precision: Precision
static method fromArabicToRoman (line 186)

Converts from arabic to roman notation

static string fromArabicToRoman (float $arabic)
  • float $arabic: Arabic number
static method fromDecimalToCurrency (line 126)

Applies monetary format on a decimal value

All empty arguments, starting from $currencySign, will be replaced by current locale settings.

static string fromDecimalToCurrency (float $number, [string $currencySign = NULL], [string $decSep = NULL], [string $thousSep = NULL], [int $precision = NULL], [string $currencySignPos = NULL])
  • float $number: Input value
  • string $currencySign: Currency sign
  • string $decSep: Decimals separator
  • string $thousSep: Thousands separator
  • int $precision: Precision
  • string $currencySignPos: Currency sign position ('left' or 'right')
static method fromDecimalToFraction (line 159)

Converts from decimal to fractionary

Returns FALSE when $number is integer.

static mixed fromDecimalToFraction (float $number)
  • float $number: Input number
static method fromHexToBin (line 102)

Converts from hexadecimal to binary

  • return: Binary number
static string fromHexToBin (string $number)
  • string $number: Hex number
static method fromRomanToArabic (line 229)

Converts from roman to arabic notation

static float fromRomanToArabic (string $roman)
  • string $roman: Roman number
static method gcd (line 352)

Calculates the greatest common divisor of 2 numbers

  • return: Result
static int gcd (int $a, int $b)
  • int $a: First number
  • int $b: Second number
static method modulus10 (line 303)

Get the modulus 10 of a given number

  • return: Modulus 10
static int modulus10 (int $number)
  • int $number: Input number
static method modulus11 (line 330)

Get the modulus 11 of a given number

  • return: Modulus 11
static int modulus11 (int $number, [int $base = 9])
  • int $number: Input number
  • int $base: Base
static method numberConversion (line 52)

Converts a number from one base to another

Accepts bases from 2 to 36.

  • return: Converted number
static mixed numberConversion (mixed $source, int $baseIn, int $baseOut, [int $targetLen = 0])
  • mixed $source: Input value
  • int $baseIn: Input base
  • int $baseOut: Output base
  • int $targetLen: Output value length
static method randomize (line 369)

Generates a random number, given an interval of values

  • return: Choosen number
static int randomize (int $rangeMin, int $rangeMax)
  • int $rangeMin: Interval start
  • int $rangeMax: Interval end

Inherited Methods

Inherited From PHP2Go

PHP2Go::PHP2Go()
PHP2Go::equals()
PHP2Go::generateUniqueId()
PHP2Go::getClassName()
PHP2Go::getConfigVal()
PHP2Go::getLangVal()
PHP2Go::getObjectName()
PHP2Go::getParentName()
PHP2Go::hasDestructor()
PHP2Go::hashCode()
PHP2Go::isA()
PHP2Go::isSubclassOf()
PHP2Go::logError()
PHP2Go::raiseError()
PHP2Go::registerDestructor()
PHP2Go::registerShutdownFunc()
PHP2Go::retrieve()
PHP2Go::store()
PHP2Go::__toString()

Documentation generated on Sun, 07 Oct 2007 19:28:02 -0300 by phpDocumentor 1.3.2