Period

This is the documentation for version 4.0 which will be supported until TBD. Please consider upgrading your code to the latest stable version

The Sequence object

If you need to manipulate multiple Period instances you can now manage them easily using the provided Sequence class. This class is a List similar to an array that uses incremental integer keys.

The Sequence class is introduced in version 4.1.

The constructor

Sequence::__construct

public Sequence::__construct(Period ...$intervals)

Instantiate a new Sequence object with the given intervals.

Example

use League\Period\Sequence;
use League\Period\Period;

$sequence = new Sequence(
    new Period('2018-01-01', '2018-01-31'),
    new Period('2018-02-10', '2018-02-20'),
    new Period('2018-03-01', '2018-03-31'),
    new Period('2018-01-20', '2018-03-10')
);

Once instantiated, you can use the Sequence object: