1--TEST--
2Test serialization of DateTime objects
3--FILE--
4<?php
5//Set the default time zone
6date_default_timezone_set("Europe/London");
7
8$date1 = new DateTime("2005-07-14 22:30:41");
9var_dump($date1);
10$serialized = serialize($date1);
11var_dump($serialized);
12
13$date2 = unserialize($serialized);
14var_dump($date2);
15// Try to use unserialzied object
16var_dump( $date2->format( "F j, Y, g:i a") );
17
18?>
19===DONE===
20--EXPECTF--
21object(DateTime)#%d (3) {
22  ["date"]=>
23  string(19) "2005-07-14 22:30:41"
24  ["timezone_type"]=>
25  int(3)
26  ["timezone"]=>
27  string(13) "Europe/London"
28}
29string(118) "O:8:"DateTime":3:{s:4:"date";s:19:"2005-07-14 22:30:41";s:13:"timezone_type";i:3;s:8:"timezone";s:13:"Europe/London";}"
30object(DateTime)#%d (3) {
31  ["date"]=>
32  string(19) "2005-07-14 22:30:41"
33  ["timezone_type"]=>
34  int(3)
35  ["timezone"]=>
36  string(13) "Europe/London"
37}
38string(23) "July 14, 2005, 10:30 pm"
39===DONE===