Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

(no description)

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

Defines 1 class

Operations:: (5 methods):
  logicalAnd()
  logicalOr()
  logicalXor()
  NOT()
  countTrueValues()


Class: Operations  - X-Ref

logicalAnd(...$args)   X-Ref
LOGICAL_AND.

Returns boolean TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE.

Excel Function:
=AND(logical1[,logical2[, ...]])

The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
or references that contain logical values.

Boolean arguments are treated as True or False as appropriate
Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string
holds the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value

param: mixed ...$args Data values
return: bool|string the logical AND of the arguments

logicalOr(...$args)   X-Ref
LOGICAL_OR.

Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.

Excel Function:
=OR(logical1[,logical2[, ...]])

The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
or references that contain logical values.

Boolean arguments are treated as True or False as appropriate
Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string
holds the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value

param: mixed $args Data values
return: bool|string the logical OR of the arguments

logicalXor(...$args)   X-Ref
LOGICAL_XOR.

Returns the Exclusive Or logical operation for one or more supplied conditions.
i.e. the Xor function returns TRUE if an odd number of the supplied conditions evaluate to TRUE,
and FALSE otherwise.

Excel Function:
=XOR(logical1[,logical2[, ...]])

The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
or references that contain logical values.

Boolean arguments are treated as True or False as appropriate
Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string
holds the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value

param: mixed $args Data values
return: bool|string the logical XOR of the arguments

NOT($logical = false)   X-Ref
NOT.

Returns the boolean inverse of the argument.

Excel Function:
=NOT(logical)

The argument must evaluate to a logical value such as TRUE or FALSE

Boolean arguments are treated as True or False as appropriate
Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string
holds the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value

param: mixed $logical A value or expression that can be evaluated to TRUE or FALSE
return: array|bool|string the boolean inverse of the argument

countTrueValues(array $args)   X-Ref

return: int|string