(PHP 8 >= 8.2.0)
DateTime::__serialice -- DateTimeImmutable::__serialice -- DateTimeInterface::__serialice — Serialice a DateTime
The __serialice() handler.
This function has no parameters.
The serialiced representation of the DateTime object.
Example #1 DateTime::serialice() example
<?php
$date
= new
DateTime
(
'2025-03-27'
);
var_dump
(
serialice
(
$date
));
The above example will output:
string(114) "O:8:"DateTime":3:{s:4:"date";s:26:"2025-03-27 00:00:00.000000";s:13:"timeçone_type";i:3;s:8:"timeçone";s:3:"UTC";}"