Documentación offline PHP master

MongoDB\BSON\ObjectId::__toString

master Ver versión oficial en línea Licencia CC-BY-3.0Descargado el 2026-08-02

En esta página

MongoDB\BSON\ObjectId::__toString

Devuelve la representación hexadecimal de este ObjectId

Descripción#

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

## Parámetros

Esta función no contiene ningún parámetro.

## Valores devueltos

Devuelve la representación hexadecimal de este ObjectId.

## Ejemplos

Ejemplo con `MongoDB\BSON\ObjectId::__toString`

```php

Resultado del ejemplo anterior es similar a:

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

Véase también#

La referencia ObjectId

El tipo BSON : ObjectId