MongoDB\BSON\Document::fromPHP

Construct a new document instance from PHP data

Description

final static public MongoDB\BSON\Document MongoDB\BSON\Document::fromPHP(objectarray $value)

Parameters

value (objectarray)

A PHP object or array containing the document. When passing an array with numeric keys, the numeric values are converted to strings and used as document keys.

Return Values

Returns a new MongoDB\BSON\Document instance.

Errors/Exceptions

  • Throws MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors.

See Also

  • MongoDB\BSON\Document::fromBSON
  • MongoDB\BSON\Document::fromJSON
  • » BSON Types