MongoDB\BSON\toPHPReturns the PHP representation of a BSON value Warning
This function has been DEPRECATED as of extension version 1.20.0 and will be removed in 2.0. Applications should use MongoDB\BSON\Document::toPHP instead. Description
arrayobject MongoDB\BSON\toPHP(string
$bson , array $typeMap = array())
Unserializes a BSON document (i.e. binary string) to its PHP representation.
The Warning
BSON documents can technically contain duplicate keys because documents are stored as a list of key-value pairs; however, applications should refrain from generating documents with duplicate keys as server and driver behavior may be undefined. Since PHP objects and arrays cannot have duplicate keys, data could also be lost when decoding a BSON document with duplicate keys. Parameters
Return ValuesThe unserialized PHP value. Errors/Exceptions
Changelog
ExamplesExample #1 MongoDB\BSON\toPHP example
The above example will output: object(stdClass)#1 (1) { ["foo"]=> int(1) } See Also
|