1--TEST-- 2Test clone of DateTimeZone derived objects with __clone magic method 3--FILE-- 4<?php 5//Set the default time zone 6date_default_timezone_set("Europe/London"); 7 8class DateTimeZoneExt1 extends DateTimeZone { 9 public function __clone() { 10 echo "-- DateTimeExt1 __clone magic method called --\n"; 11 } 12} 13 14echo "*** Testing clone of objects derived from DateTimeZone class with __clone magic method***\n"; 15 16$d1 = new DateTimeZoneExt1("America/New_York"); 17$d1_clone = clone $d1; 18 19//verify clone by calling method on new object 20var_dump( $d1_clone->getName() ); 21 22?> 23--EXPECT-- 24*** Testing clone of objects derived from DateTimeZone class with __clone magic method*** 25-- DateTimeExt1 __clone magic method called -- 26string(16) "America/New_York" 27