php8.5
Home/ Manual/ bson / binary/ MongoDB\BSON\Binary::__toString

MongoDB\BSON\Binary::__toString

PHP function Edit on GitHub ✎

(mongodb >=1.2.0)

Returns the Binary's data

Description

MongoDB\BSON\Binary::__toString(): string

Alias MongoDB\BSON\Binary::getData.

Parameters Parameters

Return Values

Returns the Binary's data.

Examples

MongoDB\BSON\Binary::__toString() example

php
<?php

var_dump((string) new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC));

?>

The above example will output:

output
string(3) "foo"

See Also

  • MongoDB\BSON\Binary::getData
  • BSON Types

Source: reference/mongodb/bson/binary/tostring.xml · from the official PHP manual (php/doc-en)