1--TEST-- 2Test DateTimeZone class inheritance 3--FILE-- 4<?php 5 6//Set the default time zone 7date_default_timezone_set("Europe/London"); 8 9echo "*** Testing basic DateTimeZone inheritance() ***\n"; 10 11class DateTimeZoneExt extends DateTimeZone 12{ 13 public function __toString() 14 { 15 return parent::getName(); 16 } 17} 18 19echo "\n-- Create an instance of DateTimeZoneExt --\n"; 20$d = new DateTimeZoneExt("America/Los_Angeles"); 21 22echo "\n-- Invoke __toString --\n"; 23echo $d . "\n"; 24 25?> 26--EXPECT-- 27*** Testing basic DateTimeZone inheritance() *** 28 29-- Create an instance of DateTimeZoneExt -- 30 31-- Invoke __toString -- 32America/Los_Angeles 33