Documentation

ConvertBinary extends ConvertBase
in package

Table of Contents

Properties

$arrayArgumentHelper  : ArrayArgumentHelper
$initializationNeeded  : bool

Methods

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

Properties

$initializationNeeded

private static bool $initializationNeeded = true

Methods

toDecimal()

toDecimal.

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

Return a binary value as decimal.

Excel Function: BIN2DEC(x)

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

The binary number (as a string) that you want to convert. The number cannot contain more than 10 characters (10 bits). The most significant bit of number is the sign bit. The remaining 9 bits are magnitude bits. Negative numbers are represented using two's-complement notation. If number is not a valid binary number, or if number contains more than 10 characters (10 bits), BIN2DEC 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 binary value as hex.

Excel Function: BIN2HEX(x[,places])

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

The binary number (as a string) that you want to convert. The number cannot contain more than 10 characters (10 bits). The most significant bit of number is the sign bit. The remaining 9 bits are magnitude bits. Negative numbers are represented using two's-complement notation. If number is not a valid binary number, or if number contains more than 10 characters (10 bits), BIN2HEX 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, BIN2HEX 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, BIN2HEX returns the #VALUE! error value. If places is negative, BIN2HEX 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[, null|array<string|int, mixed>|float|int|string $places = null ]) : array<string|int, mixed>|string

Return a binary value as octal.

Excel Function: BIN2OCT(x[,places])

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

The binary number (as a string) that you want to convert. The number cannot contain more than 10 characters (10 bits). The most significant bit of number is the sign bit. The remaining 9 bits are magnitude bits. Negative numbers are represented using two's-complement notation. If number is not a valid binary number, or if number contains more than 10 characters (10 bits), BIN2OCT 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, BIN2OCT 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, BIN2OCT returns the #VALUE! error value. If places is negative, BIN2OCT 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"

validateBinary()

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