A PHP representation of the CQL decimal datatype

The actual value of a decimal is $value * pow(10, $scale * -1)

Implements

Methods

__construct

( string $value )

Creates a decimal from a given decimal string:

<?php
$decimal = new Cassandra\Decimal("1313123123.234234234234234234123");
Parameters:
Name Type Details
$value string

Any decimal string

string

__toString

( )

String representation of this decimal.

Returns:
Type Details
string

Cassandra\Decimal value

Cassandra\Type

type

( )

The type of this decimal.

Returns:
Type Details
Cassandra\Type
string

value

( )

Cassandra\Numeric value of this decimal as string.

Returns:
Type Details
string

Cassandra\Numeric value

int

scale

( )

Scale of this decimal as int.

Returns:
Type Details
int

Scale

Parameters:
Name Type Details
$num Cassandra\Numeric

a number to add to this one

Returns:
Type Details
Cassandra\Numeric

sum

Parameters:
Name Type Details
$num Cassandra\Numeric

a number to subtract from this one

Returns:
Type Details
Cassandra\Numeric

difference

Parameters:
Name Type Details
$num Cassandra\Numeric

a number to multiply this one by

Returns:
Type Details
Cassandra\Numeric

product

Parameters:
Name Type Details
$num Cassandra\Numeric

a number to divide this one by

Returns:
Type Details
Cassandra\Numeric

quotient

Parameters:
Name Type Details
$num Cassandra\Numeric

a number to divide this one by

Returns:
Type Details
Cassandra\Numeric

remainder

Returns:
Type Details
Cassandra\Numeric

absolute value

Returns:
Type Details
Cassandra\Numeric

negative value

Returns:
Type Details
Cassandra\Numeric

square root

int

toInt

( )
Returns:
Type Details
int

this number as int

float

toDouble

( )
Returns:
Type Details
float

this number as float