MongoId::__construct
MongoCode
MongoId
PHP Manual

# MongoId::__toString

(PECL mongo >= 0.8.0)

MongoId::__toString — Returns a hexidecimal representation of this id

### Descripción

public string MongoId::__toString ( void )

### Lista de parámetros

This function has no parameters.

### Valores retornados

This id.

### Ejemplos

Example #1 MongoId::__toString() example

`<?php
$obj = array( "x" => "y" );
$m = new Mongo();
$collection = $m->selectDB("foo")->selectCollection("bar");
$collection->insert($obj);
$collection->insert($obj);
$cursor = $collection->find();
$r1 = cursor->next();
$r2 = cursor->next();
echo $r1["_id"] . "\n";
echo $r2["_id"] . "\n";
?>`

El resultado del ejemplo seria algo similar a:

    49a7011a05c677b9a916612a
    49a702d5450046d3d515d10d

MongoId::__construct
MongoCode
MongoId
PHP Manual