Please wait while we load your page...
 

Announcements

PHP Manual :: MongoDB\BSON\ObjectID::__toString



MongoDB\BSON\ObjectID::__construct || MongoDB\BSON\Regex || MongoDB\BSON\ObjectID || PHP Manual

(mongodb >=1.0.0)

MongoDB\BSON\ObjectID::__toStringReturns the hexidecimal representation of this ObjectID

Description

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

Parameters

This function has no parameters.

Return Values

Returns the hexidecimal representation of this ObjectID.

Errors/Exceptions

Examples

Example #1 MongoDB\BSON\ObjectID::__toString() example

<?php

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

?>

The above example will output something similar to:

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


MongoDB\BSON\ObjectID::__construct || MongoDB\BSON\Regex || MongoDB\BSON\ObjectID || PHP Manual
Live Chat Not Available