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--EXPECTF--
20object(DateTime)#%d (3) {
21  ["date"]=>
22  string(26) "2005-07-14 22:30:41.000000"
23  ["timezone_type"]=>
24  int(3)
25  ["timezone"]=>
26  string(13) "Europe/London"
27}
28string(125) "O:8:"DateTime":3:{s:4:"date";s:26:"2005-07-14 22:30:41.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:13:"Europe/London";}"
29object(DateTime)#%d (3) {
30  ["date"]=>
31  string(26) "2005-07-14 22:30:41.000000"
32  ["timezone_type"]=>
33  int(3)
34  ["timezone"]=>
35  string(13) "Europe/London"
36}
37string(23) "July 14, 2005, 10:30 pm"
38