Movatterモバイル変換


[0]ホーム

URL:


PHP 8.5.0 Alpha 2 available for testing
    MongoDB\BSON\toCanonicalExtendedJSON »
    « MongoDB\BSON\fromJSON

    MongoDB\BSON\fromPHP

    (mongodb >=1.0.0)

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

    Warning

    This function has beenDEPRECATED as of extension version 1.20.0 and was removed in 2.0. Applications should useMongoDB\BSON\Document::fromPHP() instead.

    Description

    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.

    Parameters

    value (array|object)

    PHP value to be serialized.

    Return Values

    The serialized BSON document as a binary string.

    Errors/Exceptions

    Changelog

    VersionDescription
    PECL mongodb 2.0.0 This function was removed.

    Examples

    Example #1MongoDB\BSON\fromPHP() example

    <?php

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

    ?>

    The above example will output:

    0e00000010666f6f000100000000cat

    See Also

    Found A Problem?

    Learn How To Improve This PageSubmit a Pull RequestReport a Bug
    add a note

    User Contributed Notes

    There are no user contributed notes for this page.
    To Top
    and to navigate •Enter to select •Esc to close
    PressEnter without selection to search using Google

    [8]ページ先頭

    ©2009-2025 Movatter.jp