Hướng dẫn dùng decimal128 trong PHP

  • Tutorials >
  • Decimal128

Overview

MongoDB 3.4 introduced support for a Decimal128 BSON type, which is a 128-bit decimal-based floating-point value capable of emulating decimal rounding with exact precision. This functionality is intended for applications that handle monetary data, such as financial and tax computations.

The MongoDBBSONDecimal128 class, which was introduced in PHP driver 1.2.0, may be used to work with this type in PHP.

Working with Decimal128 Values

Inserting a Decimal128

The following example inserts a value of type Decimal128 into the price field of a collection named inventory:

Chủ Đề