1--TEST--
2Test DateTime class inheritance
3--FILE--
4<?php
5
6//Set the default time zone
7date_default_timezone_set("Europe/London");
8
9echo "*** Testing basic DateTime inheritance() ***\n";
10
11
12class DateTimeExt extends DateTime
13{
14	public static $format = "F j, Y, g:i:s a";
15
16	public function __toString()
17	{
18		return parent::format(self::$format);
19	}
20}
21
22echo "\n-- Create an instance of DateTimeExt --\n";
23$d = new DateTimeExt("1967-05-01 22:30:41");
24
25echo "\n-- Invoke __toString --\n";
26echo $d . "\n";
27
28echo "\n -- modify date and time --\n";
29$d->setDate(1963, 7, 2);
30$d->setTime(10, 45, 30);
31
32echo "\n-- Invoke __toString again --\n";
33echo $d . "\n";
34
35?>
36===DONE===
37--EXPECTF--
38*** Testing basic DateTime inheritance() ***
39
40-- Create an instance of DateTimeExt --
41
42-- Invoke __toString --
43May 1, 1967, 10:30:41 pm
44
45 -- modify date and time --
46
47-- Invoke __toString again --
48July 2, 1963, 10:45:30 am
49===DONE===
50