BitWise
in package
uses
ArrayEnabled
Table of Contents
Constants
- SPLIT_DIVISOR = 2 ** 24
Properties
Methods
- BITAND() : array<string|int, mixed>|int|string
- BITAND.
- BITLSHIFT() : array<string|int, mixed>|float|string
- BITLSHIFT.
- BITOR() : array<string|int, mixed>|int|string
- BITOR.
- BITRSHIFT() : array<string|int, mixed>|float|string
- BITRSHIFT.
- BITXOR() : array<string|int, mixed>|int|string
- BITXOR.
- 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.
- initialiseHelper() : void
- nullFalseTrueToNumber() : mixed
- Many functions accept null/false/true argument treated as 0/0/1.
- splitNumber() : array<string|int, int>
- Split a number into upper and lower portions for full 32-bit support.
- testFalse() : bool
- validateBitwiseArgument() : float
- Validate arguments passed to the bitwise functions.
- validateShiftAmount() : int
- Validate arguments passed to the bitwise functions.
Constants
SPLIT_DIVISOR
public
mixed
SPLIT_DIVISOR
= 2 ** 24
Properties
$arrayArgumentHelper
private
static ArrayArgumentHelper
$arrayArgumentHelper
$initializationNeeded
private
static bool
$initializationNeeded
= true
Methods
BITAND()
BITAND.
public
static BITAND(null|array<string|int, mixed>|bool|float|int|string $number1, null|array<string|int, mixed>|bool|float|int|string $number2) : array<string|int, mixed>|int|string
Returns the bitwise AND of two integer values.
Excel Function: BITAND(number1, number2)
Parameters
- $number1 : null|array<string|int, mixed>|bool|float|int|string
-
Or can be an array of values
- $number2 : null|array<string|int, mixed>|bool|float|int|string
-
Or can be an array of values
Return values
array<string|int, mixed>|int|string —If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions
BITLSHIFT()
BITLSHIFT.
public
static BITLSHIFT(null|array<string|int, mixed>|bool|float|int|string $number, null|array<string|int, mixed>|bool|float|int|string $shiftAmount) : array<string|int, mixed>|float|string
Returns the number value shifted left by shift_amount bits.
Excel Function: BITLSHIFT(number, shift_amount)
Parameters
- $number : null|array<string|int, mixed>|bool|float|int|string
-
Or can be an array of values
- $shiftAmount : null|array<string|int, mixed>|bool|float|int|string
-
Or can be an array of values
Return values
array<string|int, mixed>|float|string —If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions
BITOR()
BITOR.
public
static BITOR(null|array<string|int, mixed>|bool|float|int|string $number1, null|array<string|int, mixed>|bool|float|int|string $number2) : array<string|int, mixed>|int|string
Returns the bitwise OR of two integer values.
Excel Function: BITOR(number1, number2)
Parameters
- $number1 : null|array<string|int, mixed>|bool|float|int|string
-
Or can be an array of values
- $number2 : null|array<string|int, mixed>|bool|float|int|string
-
Or can be an array of values
Return values
array<string|int, mixed>|int|string —If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions
BITRSHIFT()
BITRSHIFT.
public
static BITRSHIFT(null|array<string|int, mixed>|bool|float|int|string $number, null|array<string|int, mixed>|bool|float|int|string $shiftAmount) : array<string|int, mixed>|float|string
Returns the number value shifted right by shift_amount bits.
Excel Function: BITRSHIFT(number, shift_amount)
Parameters
- $number : null|array<string|int, mixed>|bool|float|int|string
-
Or can be an array of values
- $shiftAmount : null|array<string|int, mixed>|bool|float|int|string
-
Or can be an array of values
Return values
array<string|int, mixed>|float|string —If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions
BITXOR()
BITXOR.
public
static BITXOR(null|array<string|int, mixed>|bool|float|int|string $number1, null|array<string|int, mixed>|bool|float|int|string $number2) : array<string|int, mixed>|int|string
Returns the bitwise XOR of two integer values.
Excel Function: BITXOR(number1, number2)
Parameters
- $number1 : null|array<string|int, mixed>|bool|float|int|string
-
Or can be an array of values
- $number2 : null|array<string|int, mixed>|bool|float|int|string
-
Or can be an array of values
Return values
array<string|int, mixed>|int|string —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>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+
nullFalseTrueToNumber()
Many functions accept null/false/true argument treated as 0/0/1.
private
static nullFalseTrueToNumber(mixed &$number) : mixed
Parameters
- $number : mixed
splitNumber()
Split a number into upper and lower portions for full 32-bit support.
private
static splitNumber(float|int $number) : array<string|int, int>
Parameters
- $number : float|int
Return values
array<string|int, int>testFalse()
private
static testFalse(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolvalidateBitwiseArgument()
Validate arguments passed to the bitwise functions.
private
static validateBitwiseArgument(mixed $value) : float
Parameters
- $value : mixed
Return values
floatvalidateShiftAmount()
Validate arguments passed to the bitwise functions.
private
static validateShiftAmount(mixed $value) : int
Parameters
- $value : mixed