\PhpOffice\PhpSpreadsheet\Calculation\EngineeringConvertBinary

Summary

Methods
Properties
Constants
toDecimal()
toHex()
toOctal()
No public properties found
No constants found
validateValue()
validatePlaces()
nbrConversionFormat()
validateBinary()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

toDecimal()

toDecimal(string  $value) : string

toDecimal.

Return a binary value as decimal.

Excel Function: BIN2DEC(x)

Parameters

string $value

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.

Returns

string —

toHex()

toHex(string  $value, int  $places = null) : string

toHex.

Return a binary value as hex.

Excel Function: BIN2HEX(x[,places])

Parameters

string $value

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.

int $places

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.

Returns

string —

toOctal()

toOctal(string  $value, int  $places = null) : string

toOctal.

Return a binary value as octal.

Excel Function: BIN2OCT(x[,places])

Parameters

string $value

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.

int $places

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.

Returns

string —

validateValue()

validateValue(mixed  $value, bool  $gnumericCheck = false) : string

Parameters

mixed $value
bool $gnumericCheck

Returns

string —

validatePlaces()

validatePlaces(mixed  $places = null) : ?int

Parameters

mixed $places

Returns

?int —

nbrConversionFormat()

nbrConversionFormat(string  $value, ?int  $places) : string

Formats a number base string value with leading zeroes.

Parameters

string $value

The "number" to pad

?int $places

The length that we want to pad this value

Returns

string —

The padded "number"

validateBinary()

validateBinary(string  $value) : string

Parameters

string $value

Returns

string —