update : 2015.11.03
php.shukuma.com

검색:
 
 
Returns a hexidecimal representation of this id

MongoId::__toString

(PECL mongo >= 0.8.0)

MongoId::__toStringReturns a hexidecimal representation of this id

설명

public string MongoId::__toString ( void )

인수

이 함수는 인수가 없습니다.

반환값

This id.

예제

Example #1 MongoId::__toString() example

<?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";

?>

위 예제의 출력 예시:

49a7011a05c677b9a916612a
49a702d5450046d3d515d10d