
MongoDBBSONTimestamp::__toString() 함수는 Timestamp 객체를 문자열로 변환합니다. 변환된 문자열은 다음과 같은 형식으로 출력됩니다.
`"timestamp:increment@host:pid:offset:priority:startTime"`
- `timestamp`: Timestamp 객체의 timestamp
- `increment`: Timestamp 객체의 increment
- `host`: 소스 호스트
- `pid`: 소스 PID
- `offset`: 소스 오프셋
- `priority`: 소스 우선순위
- `startTime`: 소스 시작 타임 스탬프
예를 들어, 다음과 같이 Timestamp 객체를 생성하고 __toString() 함수를 호출할 수 있습니다.
#hostingforum.kr
php
$timestamp = new MongoDBBSONTimestamp(1643723400, 1);
echo $timestamp->__toString(); // Output: "1643723400:1@localhost:1234:0:0:1643723400"
위 예제에서 `1643723400`는 timestamp, `1`은 increment, `localhost`은 소스 호스트, `1234`은 소스 PID, `0`은 소스 오프셋, `0`은 소스 우선순위, `1643723400`은 소스 시작 타임 스탬프를 나타냅니다.
2025-08-07 01:30