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