MongoDB\BSON\fromPHP

(mongodb >=1.0.0)

MongoDB\BSON\fromPHPReturns the BSON representation of a PHP value

说明

MongoDB\BSON\fromPHP ( array|object $value ) : string

Serializes a PHP array or object (e.g. document) to its » BSON representation. The returned binary string will describe a BSON document.

参数

value ( array|object)

PHP value to be serialized.

返回值

The serialized BSON document as a binary string.

错误/异常

范例

Example #1 MongoDB\BSON\fromPHP() example

<?php

$bson 
MongoDB\BSON\fromPHP(['foo' => 1]);
echo 
bin2hex($bson), "\n";

?>

以上例程会输出:

0e00000010666f6f000100000000cat 

参见

相关文章
php 函数 returns the bson representation of a json valuephp 函数 returns the bson representation of a php valuephp 函数 returns the canonical extended json representation of a bson valuephp 函数 returns the legacy extended json representation of a bson valuephp 函数 returns the php representation of a bson valuephp 函数 returns the relaxed extended json representation of a bson valuephp sqlite 函数 executes a query and returns either an array for one single column or the value of the first rowphp com 函数 returns the absolute value of a variantphp yaml 函数 returns the yaml representation of a valuephp hyperwave api 函数 returns value of attributephp mongodb bson binary returns a representation that can be converted to jsonphp mongodb bson decimal128 returns a representation that can be converted to jsonphp mongodb bson decimal128 returns the string representation of this decimal128php mongodb bson decimal128interface returns the string representation of this decimal128interfacephp mongodb bson int64 returns a representation that can be converted to jsonphp mongodb bson maxkey returns a representation that can be converted to jsonphp mongodb bson objectid returns the hexidecimal representation of this objectidphp mongodb bson objectidinterface returns the hexidecimal representation of this objectidinterfacephp mongodb bson symbol returns a representation that can be converted to jsonphp mongodb bson utcdatetime returns a representation that can be converted to json
关注编程学问公众号