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