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