PHP 8.3.21 Released!

DateTime::__serialize

DateTimeImmutable::__serialize

DateTimeInterface::__serialize

(PHP 8 >= 8.2.0)

DateTime::__serialize -- DateTimeImmutable::__serialize -- DateTimeInterface::__serializeSerialize a DateTime

説明

public DateTime::__serialize(): array
public DateTimeImmutable::__serialize(): array
public DateTimeInterface::__serialize(): array

The __serialize() handler.

パラメータ

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

戻り値

The serialized representation of the DateTime object.

例1 DateTime::serialize() example

<?php
$date
= new DateTime('2025-03-27');
var_dump(serialize($date));
?>

上の例の出力は以下となります。

string(114) "O:8:"DateTime":3:{s:4:"date";s:26:"2025-03-27 00:00:00.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}"

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top