1--TEST-- 2Test clone of DateTime derived objects with __clone magic method 3--FILE-- 4<?php 5//Set the default time zone 6date_default_timezone_set("Europe/London"); 7 8//Set the default time zone 9date_default_timezone_set("Europe/London"); 10 11class DateTimeExt1 extends DateTime { 12 public function __clone() { 13 echo "-- DateTimeExt1 __clone magic method called --\n"; 14 } 15} 16 17echo "*** Testing clone of objects derived from DateTime class with __clone magic method***\n"; 18 19$d1 = new DateTimeExt1("2009-02-03 12:34:41 GMT"); 20$d1_clone = clone $d1; 21 22//verify clone by calling method on new object 23var_dump( $d1_clone->format( "m.d.y") ); 24 25?> 26--EXPECT-- 27*** Testing clone of objects derived from DateTime class with __clone magic method*** 28-- DateTimeExt1 __clone magic method called -- 29string(8) "02.03.09" 30