(mongodb >=1.0.0)
MongoDB\BSON\fromPHP — Returns the BSON representation of a PHP value
This function has been DEPRECATED as of extension version 1.20.0 and was removed in 2.0. Applications should use MongoDB\BSON\Document::fromPHP() instead.
Serializes a PHP array or object (e.g. document) to its » BSON representation. The returned binary string will describe a BSON document.
The serialized BSON document as a binary string.
Version | Description |
---|---|
PECL mongodb 2.0.0 | This function was removed. |
Example #1 MongoDB\BSON\fromPHP() example
<?php
$bson = MongoDB\BSON\fromPHP(['foo' => 1]);
echo bin2hex($bson), "\n";
?>
The above example will output:
0e00000010666f6f000100000000cat
Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!
Check out: eBank.nz (Art Generator) |
Netwrck.com (AI Tools) |
Text-Generator.io (AI API) |
BitBank.nz (Crypto AI) |
ReadingTime (Kids Reading) |
RewordGame |
BigMultiplayerChess |
WebFiddle |
How.nz |
Helix AI Assistant