(PECL mongo >= 0.8.0)
Returns a hexidecimal representation of this id
public string MongoId::__toString ( void )
Returns:
This id.
Examples:
MongoId::__toString() example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?php $m = new MongoClient(); $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" ; ?> |
The above example will output something similar to:
49a7011a05c677b9a916612a 49a702d5450046d3d515d10d
Please login to continue.