class ArithmeticOperator extends BaseOperator

Defines the supported operators for arithmetic expressions.

Learn more: Supported arithmetic operators

Methods

__construct($operator)

BaseOperator constructor.

__toString()

Serializes to string.

jsonSerialize()

Serializes to json.

add()

Add

plus()

Alias for ArithmeticOperator::add.

subtract()

Subtract

minus()

Alias for ArithmeticOperator::subtract.

multiply()

Multiply

divide()

Divide

modulo()

Modulo (remainder)

power()

Power (to the power of)

Details

__construct($operator)

BaseOperator constructor.

Parameters

Name Type Description
$operator

string __toString()

Serializes to string.

Return Value

string

mixed jsonSerialize()

Serializes to json.

Return Value

mixed

static ArithmeticOperator add()

Add

'+'

Return Value

ArithmeticOperator

static ArithmeticOperator plus()

Alias for ArithmeticOperator::add.

+

Return Value

ArithmeticOperator

See also

ArithmeticOperator::add

static ArithmeticOperator subtract()

Subtract

-

Return Value

ArithmeticOperator

static ArithmeticOperator minus()

Alias for ArithmeticOperator::subtract.

-

Return Value

ArithmeticOperator

See also

ArithmeticOperator::subtract

static ArithmeticOperator multiply()

Multiply

*

Return Value

ArithmeticOperator

static ArithmeticOperator divide()

Divide

/

Return Value

ArithmeticOperator

static ArithmeticOperator modulo()

Modulo (remainder)

%

Return Value

ArithmeticOperator

static ArithmeticOperator power()

Power (to the power of)

^

Return Value

ArithmeticOperator

Constants

ADD

SUBTRACT

MULTIPLY

DIVIDE

MODULO

POWER