Php/docs/mongodb-bson-objectid.tostring

提供:Dev Guides
< Php
移動先:案内検索

MongoDB\BSON\ObjectId::__toString

(mongodb >=1.0.0)

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


説明

final public MongoDB\BSON\ObjectId::__toString ( ) : string

パラメータ

この関数にはパラメータはありません。


返り値

Returns the hexidecimal representation of this ObjectId.


例1 MongoDB\BSON\ObjectId::__toString() example

<?phpvar_dump((string) new MongoDB\BSON\ObjectId());var_dump((string) new MongoDB\BSON\ObjectId('000000000000000000000001'));?>

上の例の出力は、 たとえば以下のようになります。


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