| MongoDB\BSON\toPHPReturns the PHP representation of a BSON value Description
   array|object MongoDB\BSON\toPHP
    ( string  $bson[, array$typeMap= []
  ] )
   Unserializes a BSON document (i.e. binary string) to its PHP representation.
   The  Parameters
 Return ValuesThe unserialized PHP value. Errors/ExceptionsThrows MongoDB\Driver\Exception\InvalidArgumentException if a class in the type map cannot be instantiated or does not implement MongoDB\BSON\Unserializable. Throws MongoDB\Driver\Exception\UnexpectedValueException if the input did not contain exactly one BSON document. Possible reasons include, but are not limited to, invalid BSON, extra data (after reading one BSON document), or an unexpected » libbson error. ExamplesExample #1 MongoDB\BSON\toPHP example 
<?phpThe above example will output: 
object(stdClass)#1 (1) {
  ["foo"]=>
  int(1)
}
See Also
 |