PHP Portal » PHP Handbuch » MongoId::__toString

Werbung

MongoId::__toString


(PECL mongo >= 0.8.0)

MongoId::__toStringReturns a hexidecimal representation of this id

Beschreibung

public string MongoId::__toString ( void )

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

This id.

Beispiele

PHP Code
1
2
3
4
5
6
7
8
9
$m = new Mongo(); $collection = $m->selectDB("foo")->selectCollection("bar"); $collection->insert(array( "x" => "y" )); $collection->insert(array( "x" => "y" )); $cursor = $collection->find(); $r1 = cursor->next(); $r2 = cursor->next(); echo $r1["_id"] . "\n"; echo $r2["_id"] . "\n";

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

49a7011a05c677b9a916612a
49a702d5450046d3d515d10d