(mongodb >=1.0.0)
MongoDB\BSON\toPHP β Returns the PHP representation of a BSON 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::toPHP() instead.
Unserializes a BSON document (i.e. binary string) to its PHP representation.
The typeMap paramater may be used to control the PHP
types used for converting BSON arrays and documents (both root and embedded).
Π’Π΅Ρ Π½ΡΡΠ½ΠΎ, BSON-Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠΈ ΠΌΠΎΠΆΡΡΡ ΠΌΡΡΡΠΈΡΠΈ ΠΏΠΎΠ²ΡΠΎΡΡΠ²Π°Π½Ρ ΠΊΠ»ΡΡΡ, ΠΎΡΠΊΡΠ»ΡΠΊΠΈ Π·Π±Π΅ΡΡΠ³Π°ΡΡΡΡΡ, ΡΠΊ ΡΠΏΠΈΡΠΊΠΈ ΠΏΠ°Ρ ΠΊΠ»ΡΡ-Π·Π½Π°ΡΠ΅Π½Π½Ρ. ΠΠ΄Π½Π°ΠΊ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΈ Π½Π΅ ΠΏΠΎΠ²ΠΈΠ½Π½Ρ ΡΡΠ²ΠΎΡΡΠ²Π°ΡΠΈ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠΈ ΡΠ· Π΄ΡΠ±Π»ΡΠΊΠ°ΡΠ°ΠΌΠΈ ΠΊΠ»ΡΡΡΠ², Π±ΠΎ ΠΏΠΎΠ²Π΅Π΄ΡΠ½ΠΊΠ° ΡΠ΅ΡΠ²Π΅ΡΠ° ΡΠ° Π΄ΡΠ°ΠΉΠ²Π΅ΡΠ° ΠΌΠΎΠΆΠ΅ Π±ΡΡΠΈ Π½Π΅Π²ΠΈΠ·Π½Π°ΡΠ΅Π½ΠΎΡ. Π’Π°ΠΊΠΎΠΆ Π΄Π°Π½Ρ ΠΌΠΎΠΆΡΡΡ Π±ΡΡΠΈ ΠΏΠΎΡΠΊΠΎΠ΄ΠΆΠ΅Π½Ρ ΠΏΡΠ΄ ΡΠ°Ρ Π΄Π΅ΠΊΠΎΠ΄ΡΠ²Π°Π½Π½Ρ BSON-Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°, Π±ΠΎ Π² PHP ΠΎΠ±'ΡΠΊΡΠΈ Π½Π΅ ΠΌΠΎΠΆΡΡΡ ΠΌΡΡΡΠΈΡΠΈ ΠΏΠΎΠ²ΡΠΎΡΡΠ²Π°Π½Ρ Π½Π°Π·Π²ΠΈ Π²Π»Π°ΡΡΠΈΠ²ΠΎΡΡΠ΅ΠΉ, Π° ΠΌΠ°ΡΠΈΠ²ΠΈ β Π΄ΡΠ±Π»ΡΠΎΠ²Π°Π½Ρ ΠΊΠ»ΡΡΡ.
The unserialized PHP value.
| ΠΠ΅ΡΡΡΡ | ΠΠΏΠΈΡ |
|---|---|
| PECL mongodb 2.0.0 | This function was removed. |
| PECL mongodb 1.4.0 |
If the input contains an unsupported, deprecated BSON type, the extension will now no longer log a warning to the debug log, but instead will create an object representing this type. |
| PECL mongodb 1.3.2 |
MongoDB\Driver\Exception\UnexpectedValueException is no longer thrown if the input contains an unsupported, deprecated BSON type. Such types will be ignored (as they were in versions before 1.3.0), although the extension will now log a warning to the debug log (see: mongodb.debug). |
| PECL mongodb 1.3.0 |
MongoDB\Driver\Exception\UnexpectedValueException is thrown if the input contains an unsupported, deprecated BSON type. Previously, such types were ignored. |
ΠΡΠΈΠΊΠ»Π°Π΄ #1 MongoDB\BSON\toPHP() example
<?php
$bson = hex2bin('0e00000010666f6f000100000000');
$value = MongoDB\BSON\toPHP($bson);
var_dump($value);
?>ΠΠΎΠ΄Π°Π½ΠΈΠΉ Π²ΠΈΡΠ΅ ΠΏΡΠΈΠΊΠ»Π°Π΄ Π²ΠΈΠ²Π΅Π΄Π΅:
object(stdClass)#1 (1) {
["foo"]=>
int(1)
}