Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

(no description)

File Size: 227 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

BitWise:: (9 methods):
  splitNumber()
  BITAND()
  BITOR()
  BITXOR()
  BITLSHIFT()
  BITRSHIFT()
  validateBitwiseArgument()
  validateShiftAmount()
  nullFalseTrueToNumber()


Class: BitWise  - X-Ref

splitNumber($number)   X-Ref
Split a number into upper and lower portions for full 32-bit support.

param: float|int $number

BITAND($number1, $number2)   X-Ref
BITAND.

Returns the bitwise AND of two integer values.

Excel Function:
BITAND(number1, number2)

return: int|string
param: int $number1
param: int $number2

BITOR($number1, $number2)   X-Ref
BITOR.

Returns the bitwise OR of two integer values.

Excel Function:
BITOR(number1, number2)

return: int|string
param: int $number1
param: int $number2

BITXOR($number1, $number2)   X-Ref
BITXOR.

Returns the bitwise XOR of two integer values.

Excel Function:
BITXOR(number1, number2)

return: int|string
param: int $number1
param: int $number2

BITLSHIFT($number, $shiftAmount)   X-Ref
BITLSHIFT.

Returns the number value shifted left by shift_amount bits.

Excel Function:
BITLSHIFT(number, shift_amount)

return: float|int|string
param: int $number
param: int $shiftAmount

BITRSHIFT($number, $shiftAmount)   X-Ref
BITRSHIFT.

Returns the number value shifted right by shift_amount bits.

Excel Function:
BITRSHIFT(number, shift_amount)

return: float|int|string
param: int $number
param: int $shiftAmount

validateBitwiseArgument($value)   X-Ref
Validate arguments passed to the bitwise functions.

return: float|int
param: mixed $value

validateShiftAmount($value)   X-Ref
Validate arguments passed to the bitwise functions.

return: int
param: mixed $value

nullFalseTrueToNumber(&$number)   X-Ref
Many functions accept null/false/true argument treated as 0/0/1.

param: mixed $number