Documentation

ConvertHex extends ConvertBase
in package

Table of Contents

Properties

$arrayArgumentHelper  : ArrayArgumentHelper|null

Methods

toBinary()  : array<string|int, mixed>|string
toBinary.
toDecimal()  : array<string|int, mixed>|string
toDecimal.
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.
validateHex()  : string
validatePlaces()  : int|null
validateValue()  : string
initialiseHelper()  : void
testFalse()  : bool

Properties

Methods

toBinary()

toBinary.

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

Return a hex value as binary.

Excel Function: HEX2BIN(x[,places])

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

The hexadecimal number you want to convert. Number cannot contain more than 10 characters. The most significant bit of number is the sign bit (40th bit from the right). The remaining 9 bits are magnitude bits. Negative numbers are represented using two's-complement notation. If number is negative, HEX2BIN ignores places and returns a 10-character binary number. If number is negative, it cannot be less than FFFFFFFE00, and if number is positive, it cannot be greater than 1FF. If number is not a valid hexadecimal number, HEX2BIN returns the #NUM! error value. If HEX2BIN 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, HEX2BIN 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, HEX2BIN returns the #VALUE! error value. If places is negative, HEX2BIN 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

toDecimal()

toDecimal.

public static toDecimal(array<string|int, mixed>|bool|float|int|string $value) : array<string|int, mixed>|string

Return a hex value as decimal.

Excel Function: HEX2DEC(x)

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

The hexadecimal number you want to convert. This number cannot contain more than 10 characters (40 bits). The most significant bit of number is the sign bit. The remaining 39 bits are magnitude bits. Negative numbers are represented using two's-complement notation. If number is not a valid hexadecimal number, HEX2DEC 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 a hex value as octal.

Excel Function: HEX2OCT(x[,places])

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

The hexadecimal number you want to convert. Number cannot contain more than 10 characters. The most significant bit of number is the sign bit. The remaining 39 bits are magnitude bits. Negative numbers are represented using two's-complement notation. If number is negative, HEX2OCT ignores places and returns a 10-character octal number. If number is negative, it cannot be less than FFE0000000, and if number is positive, it cannot be greater than 1FFFFFFF. If number is not a valid hexadecimal number, HEX2OCT returns the #NUM! error value. If HEX2OCT 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, HEX2OCT 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, HEX2OCT returns the #VALUE! error value. If places is negative, HEX2OCT 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"

validateHex()

protected static validateHex(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