MongoDB\BSON\ObjectID::__toString

Returns the hexidecimal representation of this ObjectID

Beschreibung

final public string MongoDB\BSON\ObjectID::__toString ( void )

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

Returns the hexidecimal representation of this ObjectID.

Fehler/Exceptions

  • Throws MongoDB\Driver\InvalidArgumentException on argument parsing errors.

Beispiele

Beispiel #1 MongoDB\BSON\ObjectID::__toString example

<?php

var_dump
((string) new MongoDB\BSON\ObjectId());
var_dump((string) new MongoDB\BSON\ObjectId('000000000000000000000001'));

?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

string(24) "56731b49da14d8747d701211"
string(24) "000000000000000000000001"