1--TEST-- 2Test of compare object handler for DateTime objects 3--FILE-- 4<?php 5 6// NB: DateTimeZone class does not define a customized compare class handler so standard object handler will be used 7 8echo "Simple test for DateTimeZone compare object handler\n"; 9 10//Set the default time zone 11date_default_timezone_set("Europe/London"); 12 13class DateTimeZoneExt1 extends DateTimeZone { 14} 15 16class DateTimeZoneExt2 extends DateTimeZone{ 17 public $foo = "Hello"; 18 private $bar = 99; 19} 20 21class DateTimeZoneExt3 extends DateTimeZoneExt2 { 22} 23 24$obj1 = new DateTimeZone("Europe/London"); 25$obj2 = new DateTimeZoneExt1("Europe/London"); 26$obj3 = new DateTimeZoneExt2("Europe/London"); 27$obj4 = new DateTimeZoneExt3("Europe/London"); 28 29echo "\n-- All the following tests should compare equal --\n"; 30var_dump($obj1 == $obj1); 31echo "\n-- All the following tests should compare NOT equal --\n"; 32var_dump($obj1 == $obj2); 33var_dump($obj1 == $obj3); 34var_dump($obj1 == $obj4); 35var_dump($obj2 == $obj3); 36var_dump($obj2 == $obj4); 37var_dump($obj3 == $obj4); 38 39?> 40===DONE=== 41--EXPECT-- 42Simple test for DateTimeZone compare object handler 43 44-- All the following tests should compare equal -- 45bool(true) 46 47-- All the following tests should compare NOT equal -- 48bool(false) 49bool(false) 50bool(false) 51bool(false) 52bool(false) 53bool(false) 54===DONE===