1--TEST-- 2Test clone of DateTimeZOne objects 3--FILE-- 4<?php 5//Set the default time zone 6date_default_timezone_set("Europe/London"); 7 8echo "*** Testing clone on DateTime objects ***\n"; 9 10echo "\n-- Create a DateTimeZone object --\n"; 11$d1 = new DateTimeZone("Europe/London"); 12var_dump($d1); 13echo "\n-- Add some properties --\n"; 14$d1->property1 = 99; 15$d1->property2 = "Hello"; 16var_dump($d1); 17echo "\n-- clone it --\n"; 18$d1_clone = clone $d1; 19var_dump($d1_clone); 20echo "\n-- Add some more properties --\n"; 21$d1_clone->property3 = true; 22$d1_clone->property4 = 10.5; 23var_dump($d1_clone); 24echo "\n-- clone it --\n"; 25$d2_clone = clone $d1_clone; 26var_dump($d2_clone); 27?> 28===DONE=== 29--EXPECTF-- 30*** Testing clone on DateTime objects *** 31 32-- Create a DateTimeZone object -- 33object(DateTimeZone)#%d (0) { 34} 35 36-- Add some properties -- 37object(DateTimeZone)#%d (2) { 38 ["property1"]=> 39 int(99) 40 ["property2"]=> 41 string(5) "Hello" 42} 43 44-- clone it -- 45object(DateTimeZone)#%d (2) { 46 ["property1"]=> 47 int(99) 48 ["property2"]=> 49 string(5) "Hello" 50} 51 52-- Add some more properties -- 53object(DateTimeZone)#%d (4) { 54 ["property1"]=> 55 int(99) 56 ["property2"]=> 57 string(5) "Hello" 58 ["property3"]=> 59 bool(true) 60 ["property4"]=> 61 float(10.5) 62} 63 64-- clone it -- 65object(DateTimeZone)#%d (4) { 66 ["property1"]=> 67 int(99) 68 ["property2"]=> 69 string(5) "Hello" 70 ["property3"]=> 71 bool(true) 72 ["property4"]=> 73 float(10.5) 74} 75===DONE=== 76