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--EXPECTF-- 29*** Testing clone on DateTime objects *** 30 31-- Create a DateTimeZone object -- 32object(DateTimeZone)#%d (2) { 33 ["timezone_type"]=> 34 int(3) 35 ["timezone"]=> 36 string(13) "Europe/London" 37} 38 39-- Add some properties -- 40object(DateTimeZone)#%d (4) { 41 ["property1"]=> 42 int(99) 43 ["property2"]=> 44 string(5) "Hello" 45 ["timezone_type"]=> 46 int(3) 47 ["timezone"]=> 48 string(13) "Europe/London" 49} 50 51-- clone it -- 52object(DateTimeZone)#%d (4) { 53 ["property1"]=> 54 int(99) 55 ["property2"]=> 56 string(5) "Hello" 57 ["timezone_type"]=> 58 int(3) 59 ["timezone"]=> 60 string(13) "Europe/London" 61} 62 63-- Add some more properties -- 64object(DateTimeZone)#%d (6) { 65 ["property1"]=> 66 int(99) 67 ["property2"]=> 68 string(5) "Hello" 69 ["property3"]=> 70 bool(true) 71 ["property4"]=> 72 float(10.5) 73 ["timezone_type"]=> 74 int(3) 75 ["timezone"]=> 76 string(13) "Europe/London" 77} 78 79-- clone it -- 80object(DateTimeZone)#%d (6) { 81 ["property1"]=> 82 int(99) 83 ["property2"]=> 84 string(5) "Hello" 85 ["property3"]=> 86 bool(true) 87 ["property4"]=> 88 float(10.5) 89 ["timezone_type"]=> 90 int(3) 91 ["timezone"]=> 92 string(13) "Europe/London" 93} 94