php8.5
Home/ Manual/ bson / decimal128/ MongoDB\BSON\Decimal128::__toString

MongoDB\BSON\Decimal128::__toString

PHP function Edit on GitHub ✎

(mongodb >=1.2.0)

Returns the string representation of this Decimal128

Description

MongoDB\BSON\Decimal128::__toString(): string

Parameters Parameters

Return Values

Returns the string representation of this Decimal128.

Examples

MongoDB\BSON\Decimal128::__toString() example

php
<?php

var_dump((string) new MongoDB\BSON\Decimal128(1234.5678));
var_dump((string) new MongoDB\BSON\Decimal128(NAN));
var_dump((string) new MongoDB\BSON\Decimal128(INF));

?>

The above example will output something similar to:

output
string(9) "1234.5678"
string(3) "NaN"
string(8) "Infinity"

See Also

  • Decimal128 floating-point format
  • BSON Types

Source: reference/mongodb/bson/decimal128/tostring.xml · from the official PHP manual (php/doc-en)