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--EXPECT--
37*** Testing basic DateTime inheritance() ***
38
39-- Create an instance of DateTimeExt --
40
41-- Invoke __toString --
42May 1, 1967, 10:30:41 pm
43
44 -- modify date and time --
45
46-- Invoke __toString again --
47July 2, 1963, 10:45:30 am
48