1--TEST--
2DatePeriod
3--FILE--
4<?php
5date_default_timezone_set('UTC');
6$db1 = new DateTimeImmutable( '2008-01-01' );
7$db2 = new DateTime( '2008-01-01' );
8$de = new DateTime( '2008-03-31' );
9$di = DateInterval::createFromDateString( 'first day of next month' );
10
11foreach ( new DatePeriod( $db1, $di, $de ) as $dt )
12{
13    echo get_class( $dt ), "\n";
14    echo $dt->format( "l Y-m-d\n" );
15    echo $dt->modify( "3 tuesday" )->format( "l Y-m-d\n" );
16    echo $dt->format( "l Y-m-d\n\n" );
17}
18
19foreach ( new DatePeriod( $db2, $di, $de ) as $dt )
20{
21    echo get_class( $dt ), "\n";
22    echo $dt->format( "l Y-m-d\n" );
23    echo $dt->modify( "3 tuesday" )->format( "l Y-m-d\n" );
24    echo $dt->format( "l Y-m-d\n\n" );
25}
26?>
27--EXPECT--
28DateTimeImmutable
29Tuesday 2008-01-01
30Tuesday 2008-01-15
31Tuesday 2008-01-01
32
33DateTimeImmutable
34Friday 2008-02-01
35Tuesday 2008-02-19
36Friday 2008-02-01
37
38DateTimeImmutable
39Saturday 2008-03-01
40Tuesday 2008-03-18
41Saturday 2008-03-01
42
43DateTime
44Tuesday 2008-01-01
45Tuesday 2008-01-15
46Tuesday 2008-01-15
47
48DateTime
49Friday 2008-02-01
50Tuesday 2008-02-19
51Tuesday 2008-02-19
52
53DateTime
54Saturday 2008-03-01
55Tuesday 2008-03-18
56Tuesday 2008-03-18
57