PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

MongoBinData::__construct

(PECL mongo >= 0.8.1)

MongoBinData::__constructCreates a new binary data object.

Description

public MongoBinData::__construct ( string $data [, int $type = 2 ] )

Creates a new binary data object.

There are five types of binary data currently recognized by the BSON spec: function (0x01), byte array (0x02), UUID (0x03), MD5 (0x05), and user defined (0x80). The default type is byte array (0x02). There is no particular difference in how the driver or server interpret different types, so by and large they are irrelevant for now. Any number (between 0 and 255) could be used for type, if the user is willing to assume the risk that the database might eventually do something with binary data based on type.

Parameters

data

Binary data.

type

Data type.

Return Values

Returns a new binary data object.

Changelog

Version Description
1.2.11 Emits E_DEPRECATED when the second argument is not used. The default value for type may change in the near future.

PHP Manual