array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'mongodb-bson-packedarray.tocanonicalextendedjson.php', 1 => 'MongoDB\\BSON\\PackedArray::toCanonicalExtendedJSON', 2 => 'Returns the Canonical Extended JSON representation of the BSON array', ), 'up' => array ( 0 => 'class.mongodb-bson-packedarray.php', 1 => 'MongoDB\\BSON\\PackedArray', ), 'prev' => array ( 0 => 'mongodb-bson-packedarray.offsetunset.php', 1 => 'MongoDB\\BSON\\PackedArray::offsetUnset', ), 'next' => array ( 0 => 'mongodb-bson-packedarray.tophp.php', 1 => 'MongoDB\\BSON\\PackedArray::toPHP', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mongodb/bson/packedarray/tocanonicalextendedjson.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

MongoDB\BSON\PackedArray::toCanonicalExtendedJSON

(mongodb >=1.20.0)

MongoDB\BSON\PackedArray::toCanonicalExtendedJSONReturns the Canonical Extended JSON representation of the BSON array

Опис

final public MongoDB\BSON\PackedArray::toCanonicalExtendedJSON(): string

Converts the BSON array to its » Canonical Extended JSON representation. The canonical format prefers type fidelity at the expense of concise output and is most suited for producing output that can be converted back to BSON without any loss of type information (e.g. numeric types will remain differentiated).

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Returns a string containing the » Canonical Extended JSON representation of the BSON array.

Приклади

Приклад #1 MongoDB\BSON\PackedArray::toCanonicalExtendedJSON() example

<?php

$array
= [
'foo',
123,
4294967295,
new
MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1'),
];

$packedArray = MongoDB\BSON\PackedArray::fromPHP($array);
echo
$packedArray->toCanonicalExtendedJSON(), "\n";

?>

Поданий вище приклад виведе:

[ "foo", { "$numberInt" : "123" }, { "$numberLong" : "4294967295" }, { "$oid" : "56315a7c6118fd1b920270b1" } ]

Прогляньте також