Documentation

ConvertDecimal extends ConvertBase
in package

Table of Contents

Constants

LARGEST_BINARY_IN_DECIMAL  = 511
LARGEST_HEX_IN_DECIMAL  = 549755813887
LARGEST_OCTAL_IN_DECIMAL  = 536870911
SMALLEST_BINARY_IN_DECIMAL  = -512
SMALLEST_HEX_IN_DECIMAL  = -549755813888
SMALLEST_OCTAL_IN_DECIMAL  = -536870912

Properties

$arrayArgumentHelper  : ArrayArgumentHelper|null

Methods

hex32bit()  : string
toBinary()  : array<string|int, mixed>|string
toBinary.
toHex()  : array<string|int, mixed>|string
toHex.
toOctal()  : array<string|int, mixed>|string
toOctal.
evaluateArrayArguments()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
evaluateArrayArgumentsIgnore()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
evaluateArrayArgumentsSubset()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
evaluateArrayArgumentsSubsetFrom()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
evaluateSingleArgumentArray()  : array<string|int, mixed>
Handles array argument processing when the function accepts a single argument that can be an array argument.
nbrConversionFormat()  : string
Formats a number base string value with leading zeroes.
validateDecimal()  : string
validatePlaces()  : int|null
validateValue()  : string
initialiseHelper()  : void
testFalse()  : bool

Constants

LARGEST_BINARY_IN_DECIMAL

public mixed LARGEST_BINARY_IN_DECIMAL = 511

LARGEST_HEX_IN_DECIMAL

public mixed LARGEST_HEX_IN_DECIMAL = 549755813887

LARGEST_OCTAL_IN_DECIMAL

public mixed LARGEST_OCTAL_IN_DECIMAL = 536870911

SMALLEST_BINARY_IN_DECIMAL

public mixed SMALLEST_BINARY_IN_DECIMAL = -512

SMALLEST_HEX_IN_DECIMAL

public mixed SMALLEST_HEX_IN_DECIMAL = -549755813888

SMALLEST_OCTAL_IN_DECIMAL

public mixed SMALLEST_OCTAL_IN_DECIMAL = -536870912

Properties

Methods

hex32bit()

public static hex32bit(float $value, string $hexstr[, bool $force = false ]) : string
Parameters
$value : float
$hexstr : string
$force : bool = false
Return values
string

toBinary()

toBinary.

public static toBinary(array<string|int, mixed>|bool|float|int|string $value[, null|array<string|int, mixed>|float|int|string $places = null ]) : array<string|int, mixed>|string

Return a decimal value as binary.

Excel Function: DEC2BIN(x[,places])

Parameters
$value : array<string|int, mixed>|bool|float|int|string

The decimal integer you want to convert. If number is negative, valid place values are ignored and DEC2BIN returns a 10-character (10-bit) binary number in which the most significant bit is the sign bit. The remaining 9 bits are magnitude bits. Negative numbers are represented using two's-complement notation. If number < -512 or if number > 511, DEC2BIN returns the #NUM! error value. If number is nonnumeric, DEC2BIN returns the #VALUE! error value. If DEC2BIN requires more than places characters, it returns the #NUM! error value. Or can be an array of values

$places : null|array<string|int, mixed>|float|int|string = null

The number of characters to use. If places is omitted, DEC2BIN uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros). If places is not an integer, it is truncated. If places is nonnumeric, DEC2BIN returns the #VALUE! error value. If places is zero or negative, DEC2BIN returns the #NUM! error value. Or can be an array of values

Return values
array<string|int, mixed>|string

Result, or an error If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions

toHex()

toHex.

public static toHex(array<string|int, mixed>|bool|float|int|string $value[, null|array<string|int, mixed>|float|int|string $places = null ]) : array<string|int, mixed>|string

Return a decimal value as hex.

Excel Function: DEC2HEX(x[,places])

Parameters
$value : array<string|int, mixed>|bool|float|int|string

The decimal integer you want to convert. If number is negative, places is ignored and DEC2HEX returns a 10-character (40-bit) hexadecimal number in which the most significant bit is the sign bit. The remaining 39 bits are magnitude bits. Negative numbers are represented using two's-complement notation. If number < -549,755,813,888 or if number > 549,755,813,887, DEC2HEX returns the #NUM! error value. If number is nonnumeric, DEC2HEX returns the #VALUE! error value. If DEC2HEX requires more than places characters, it returns the #NUM! error value. Or can be an array of values

$places : null|array<string|int, mixed>|float|int|string = null

The number of characters to use. If places is omitted, DEC2HEX uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros). If places is not an integer, it is truncated. If places is nonnumeric, DEC2HEX returns the #VALUE! error value. If places is zero or negative, DEC2HEX returns the #NUM! error value. Or can be an array of values

Return values
array<string|int, mixed>|string

Result, or an error If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions

toOctal()

toOctal.

public static toOctal(array<string|int, mixed>|bool|float|int|string $value[, array<string|int, mixed>|int $places = null ]) : array<string|int, mixed>|string

Return an decimal value as octal.

Excel Function: DEC2OCT(x[,places])

Parameters
$value : array<string|int, mixed>|bool|float|int|string

The decimal integer you want to convert. If number is negative, places is ignored and DEC2OCT returns a 10-character (30-bit) octal number in which the most significant bit is the sign bit. The remaining 29 bits are magnitude bits. Negative numbers are represented using two's-complement notation. If number < -536,870,912 or if number > 536,870,911, DEC2OCT returns the #NUM! error value. If number is nonnumeric, DEC2OCT returns the #VALUE! error value. If DEC2OCT requires more than places characters, it returns the #NUM! error value. Or can be an array of values

$places : array<string|int, mixed>|int = null

The number of characters to use. If places is omitted, DEC2OCT uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros). If places is not an integer, it is truncated. If places is nonnumeric, DEC2OCT returns the #VALUE! error value. If places is zero or negative, DEC2OCT returns the #NUM! error value. Or can be an array of values

Return values
array<string|int, mixed>|string

Result, or an error If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions

evaluateArrayArguments()

Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.

protected static evaluateArrayArguments(callable $method, mixed ...$arguments) : array<string|int, mixed>

Example use for: ROUND() or DATE().

Parameters
$method : callable
$arguments : mixed
Return values
array<string|int, mixed>

evaluateArrayArgumentsIgnore()

Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.

protected static evaluateArrayArgumentsIgnore(callable $method, int $ignore, mixed ...$arguments) : array<string|int, mixed>

Example use for: HLOOKUP() and VLOOKUP(), where argument 1 is a matrix that needs to be treated as a database rather than as an array argument.

Parameters
$method : callable
$ignore : int
$arguments : mixed
Return values
array<string|int, mixed>

evaluateArrayArgumentsSubset()

Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.

protected static evaluateArrayArgumentsSubset(callable $method, int $limit, mixed ...$arguments) : array<string|int, mixed>

Example use for: NETWORKDAYS() or CONCATENATE(), where the last argument is a matrix (or a series of values) that need to be treated as a such rather than as an array arguments.

Parameters
$method : callable
$limit : int
$arguments : mixed
Return values
array<string|int, mixed>

evaluateArrayArgumentsSubsetFrom()

Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.

protected static evaluateArrayArgumentsSubsetFrom(callable $method, int $start, mixed ...$arguments) : array<string|int, mixed>

Example use for: Z.TEST() or INDEX(), where the first argument 1 is a matrix that needs to be treated as a dataset rather than as an array argument.

Parameters
$method : callable
$start : int
$arguments : mixed
Return values
array<string|int, mixed>

evaluateSingleArgumentArray()

Handles array argument processing when the function accepts a single argument that can be an array argument.

protected static evaluateSingleArgumentArray(callable $method, array<string|int, mixed> $values) : array<string|int, mixed>

Example use for: DAYOFMONTH() or FACT().

Parameters
$method : callable
$values : array<string|int, mixed>
Return values
array<string|int, mixed>

nbrConversionFormat()

Formats a number base string value with leading zeroes.

protected static nbrConversionFormat(string $value, int|null $places) : string
Parameters
$value : string

The "number" to pad

$places : int|null

The length that we want to pad this value

Return values
string

The padded "number"

validateDecimal()

protected static validateDecimal(string $value) : string
Parameters
$value : string
Return values
string

validatePlaces()

protected static validatePlaces([mixed $places = null ]) : int|null
Parameters
$places : mixed = null
Return values
int|null

validateValue()

protected static validateValue(mixed $value) : string
Parameters
$value : mixed
Return values
string

initialiseHelper()

private static initialiseHelper(array<string|int, mixed>|false $arguments) : void
Parameters
$arguments : array<string|int, mixed>|false

Can be changed to array for Php8.1+

testFalse()

private static testFalse(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

        
On this page

Search results