(mongodb >=1.0.0)
MongoDB\BSON\ObjectID::__construct — Construct a new ObjectID
$id
] )
id
(string)A 24-character hexadecimal string. If not provided, the driver will generate an ObjectID.
id
is not a 24-character hexadecimal string.Example #1 MongoDB\BSON\ObjectID::__construct() example
<?php
var_dump(new MongoDB\BSON\ObjectID());
var_dump(new MongoDB\BSON\ObjectID('000000000000000000000001'));
?>
The above example will output something similar to:
object(MongoDB\BSON\ObjectID)#1 (1) { ["oid"]=> string(24) "56732d3dda14d81214634921" } object(MongoDB\BSON\ObjectID)#1 (1) { ["oid"]=> string(24) "000000000000000000000001" }