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 ibm db2 函数 returns the last connection error message and sqlcode valuephp firebird/interbase 函数 increments the named generator and returns its new valuephp 函数 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 sqlsrv 函数 returns the value of the specified configuration settingphp statistic 函数 returns the t value from the independent two sample t testphp statistic 函数 returns the t value of the dependent t test for paired samplesphp yaml 函数 returns the yaml representation of a valuephp yp/nis 函数 returns the first key value pair from the named mapphp mongodb bson dbpointer returns a representation that can be converted to jsonphp mongodb bson minkey returns a representation that can be converted to jsonphp mongodb bson regex returns the string representation of this regexphp mongodb bson regexinterface returns the string representation of this regexinterfacephp mongodb bson timestamp returns the string representation of this timestampphp mongodb bson utcdatetimeinterface returns the datetime representation of this utcdatetimeinterfacephp mongodb bson utcdatetimeinterface returns the string representation of this utcdatetimeinterface
关注编程学问公众号